-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a python script to convert mp4 files into torrents
Also uploaded 20 torrents.
- Loading branch information
1 parent
2567b61
commit bd8f42d
Showing
21 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pathlib | ||
|
||
from torrentool.api import Torrent | ||
|
||
|
||
def create_torrent_from_video(videos_directory: str, torrents_directory: str, tracker_urls: str = None): | ||
""" | ||
Convert mp4 video files into torrent files and print the magnet link for each. | ||
:param videos_directory: The directory from which to extract the videos. | ||
:param torrents_directory: The directory in which the torrents will be created. | ||
:param tracker_urls: Optional if the user wishes to specify tracker urls. | ||
""" | ||
for video in pathlib.Path(videos_directory).glob('*.mp4'): | ||
torrent = Torrent.create_from(video) | ||
if tracker_urls is not None: | ||
torrent.announce_urls = tracker_urls | ||
pathlib.Path(torrents_directory).mkdir(parents=True, exist_ok=True) | ||
torrent.to_file(f"{torrents_directory}/{video.stem}.torrent") | ||
print(f"{torrent}\n{torrent.magnet_link}\n") | ||
|
||
|
||
if __name__ == "__main__": | ||
videos_dir = "CC Videos" | ||
torrents_dir = "Torrents" | ||
tracker = "udp://tracker.openbittorrent.com:80" | ||
|
||
create_torrent_from_video(videos_dir, torrents_dir, tracker) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.