{"id":19508178,"url":"https://github.com/philogicae/mediagram","last_synced_at":"2025-04-26T02:33:57.006Z","repository":{"id":50904457,"uuid":"520120049","full_name":"philogicae/Mediagram","owner":"philogicae","description":"Headless media server, controlled via Telegram, to download torrent files and stream them on local network. Made to be hosted on Raspberry Pi 4b.","archived":true,"fork":false,"pushed_at":"2023-12-08T18:47:53.000Z","size":123,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T09:35:07.068Z","etag":null,"topics":["raspberry-pi","smart-tv","streaming","telegram-bot","torrent-downloader"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philogicae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-01T13:23:43.000Z","updated_at":"2024-08-22T21:20:15.000Z","dependencies_parsed_at":"2023-12-07T03:23:48.080Z","dependency_job_id":"c4728633-b127-4e35-8181-5b20661d40f7","html_url":"https://github.com/philogicae/Mediagram","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philogicae%2FMediagram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philogicae%2FMediagram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philogicae%2FMediagram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philogicae%2FMediagram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philogicae","download_url":"https://codeload.github.com/philogicae/Mediagram/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250922212,"owners_count":21508290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["raspberry-pi","smart-tv","streaming","telegram-bot","torrent-downloader"],"created_at":"2024-11-10T23:04:10.433Z","updated_at":"2025-04-26T02:33:56.737Z","avatar_url":"https://github.com/philogicae.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mediagram\r\n\r\nHeadless media server, controlled via Telegram, to download torrent files and stream them on local network.\r\nMade to be hosted on Raspberry Pi 4b.\r\n\r\n## 1) Requirements\r\n\r\n```bash\r\nsudo apt update -y\r\nsudo apt full-upgrade -y\r\nsudo apt install ntfs-3g exfat-fuse minidlna qbittorrent-nox tmux -y\r\n```\r\n\r\n## 2) Media server (MiniDLNA)\r\n\r\n```bash\r\nsudo mkdir /media\r\nsudo bash -c \"echo 'friendly_name=Mediagram\r\nmedia_dir=/media\r\nport=8200\r\nroot_container=B\r\nnotify_interval=60\r\n#network_interface=eth0' \u003e /etc/minidlna.conf\"\r\nsudo bash -c \"echo 'sudo service minidlna force-reload \u0026\u0026 echo \\\"/media: refresh.\\\"' \u003e /media/refresh.sh\"\r\nsudo chmod +x /media/refresh.sh\r\n\r\n# [Optional] To add the script as a command:\r\nsudo echo 'alias media-refresh=\"/media/refresh.sh\"' \u003e\u003e ~/.bashrc\r\nsource ~/.bashrc\r\n```\r\n\r\n## 3) Storage (USB/SD/SSD/HDD)\r\n\r\nPrefer NTFS file system: faster to read/write and supports larger files.\r\n(Source: https://miqu.me/blog/2015/01/14/tip-exfat-hdd-with-raspberry-pi/)\r\n\r\n```ini\r\n# Automatically (To append in /etc/fstab):\r\n/dev/sda1 /media/mnt/ auto defaults,auto,relatime,umask=000,user,rw,nofail,x-systemd.device-timeout=10 0\r\n```\r\n\r\n```bash\r\n# [Optional] Manually:\r\nsudo bash -c \"echo 'sudo mount -o umask=0 /dev/sda1 /media/mnt \u0026\u0026 echo \\\"/media/mnt: mounted.\\\"' \u003e /media/mount.sh\"\r\nsudo bash -c \"echo 'sudo umount /media/mnt \u0026\u0026 echo \\\"/media/mnt: unmounted.\\\"' \u003e /media/umount.sh\"\r\nsudo chmod +x /media/mount.sh\r\nsudo chmod +x /media/umount.sh\r\nsudo echo 'alias media-mount=\"/media/mount.sh\"\r\nalias media-umount=\"/media/umount.sh\"' \u003e\u003e ~/.bashrc\r\nsource ~/.bashrc\r\n```\r\n\r\n## 4) qbittorrent-nox\r\n\r\nWe need to register qbittorrent-nox as a service.\r\n(Source: https://www.linuxcapable.com/how-to-install-latest-qbittorrent-on-ubuntu-20-04-desktop-and-server/#Import_qBittorrent-nox_Stable)\r\n\r\n```bash\r\nsudo adduser --system --group qbittorrent-nox\r\nsudo adduser \u003cyour-username\u003e qbittorrent-nox\r\nsudo bash -c \"echo '[Unit]\r\nDescription=qBittorrent Command Line Client\r\nAfter=network.target\r\n[Service]\r\nType=forking\r\nUser=qbittorrent-nox\r\nGroup=qbittorrent-nox\r\nUMask=007\r\nExecStart=/usr/bin/qbittorrent-nox -d --webui-port=8080\r\nRestart=on-failure\r\n[Install]\r\nWantedBy=multi-user.target' \u003e /etc/systemd/system/qbittorrent-nox.service\"\r\nsudo systemctl daemon-reload\r\n```\r\n\r\nSettings:\r\n\r\n```\r\nDefault url: http://localhost:8080\r\nDefault account: admin/adminadmin\r\n[Download] Delete .torrent files afterwards ✔️\r\n[Download] Default Save Path = \u003cyour-storage-directory\u003e\r\n[Download] Keep incomplete torrents in = \u003cyour-storage-directory\u003e (Allows streaming of incomplete torrents)\r\n[Web UI] Bypass authentication for clients on localhost ✔️\r\n```\r\n\r\n## 5) Telegram bot\r\n\r\nFollow:\r\nhttps://core.telegram.org/bots#6-botfather\r\n\r\n## 6) Deploy from PC to Raspberry Pi with SSH\r\n\r\nDuplicate deploy_rpi.sh, modify HOST, PORT, SRC, DEST, and then deploy:\r\n\r\n```bash\r\n./deploy_rpi_local.sh\r\n```\r\n\r\n## 7) Environment variables\r\n\r\nCreate .env file.\r\n\r\n```bash\r\nsudo nano Mediagram/.env\r\n```\r\n\r\nCreate accounts: opensubtitles.org (V1) and opensubtitles.com (V2).\r\nThen paste the modified following lines:\r\n\r\n```ini\r\nTELEGRAM_BOT_ID=\u003cyour-bot-id\u003e\r\nTELEGRAM_CHAT_ID=\u003cyour-chat-id\u003e\r\nDIR_PROD=\u003cyour-storage-directory-for-production\u003e\r\nDIR_PROD_ALT=\u003calt-storage-directory-for-production\u003e\r\nDIR_TEST=\u003cyour-storage-directory-for-test\u003e\r\nQB_ADDR=\u003chttp://host:port\u003e\r\nQB_USER=\u003cqbittorrent-account\u003e\r\nQB_PASS=\u003cpassword\u003e\r\nOST_USER=\u003copensubtitles-account\u003e\r\nOST_PASS=\u003cpassword\u003e\r\nOST_API_KEY=\u003capi-key\u003e (if V2)\r\n```\r\n\r\n## Run\r\n\r\n```bash\r\ntmux # https://www.howtogeek.com/671422/how-to-use-tmux-on-linux-and-why-its-better-than-screen/\r\npip install -U -r requirements.txt\r\npython main.py\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilogicae%2Fmediagram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilogicae%2Fmediagram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilogicae%2Fmediagram/lists"}