Skip to content

Commit

Permalink
Merge pull request #1 from tindor/feature/dynamic-file-extension
Browse files Browse the repository at this point in the history
Added a configuration for the video file extension
  • Loading branch information
whimsical-c4lic0 authored Apr 30, 2024
2 parents 05141fd + 95ef278 commit f90ac52
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@
# Specify match type when specified height
# Possible values: exact, exact_or_least_higher, exact_or_highest_lower, closest
# Beware of the exact policy. Nothing gets downloaded if the wanted resolution is not available
WANTED_RESOLUTION_PREFERENCE = 'closest'
WANTED_RESOLUTION_PREFERENCE = 'closest'

# Video files will be saved with the specified extension.
# For example, if '.mkv' is used, the file will be saved in the mkv format and you will be able to
# watch it while it's being downloaded.
# Also, if someting goes wrong, you will still be able to play the partially downloaded mkv file,
# as opposed to a mp4 file.
VIDEO_FILE_EXTENSION = '.mkv'
4 changes: 2 additions & 2 deletions streamonitor/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import requests.cookies

import streamonitor.log as log
from parameters import DOWNLOADS_DIR, DEBUG, WANTED_RESOLUTION, WANTED_RESOLUTION_PREFERENCE
from parameters import DOWNLOADS_DIR, DEBUG, WANTED_RESOLUTION, WANTED_RESOLUTION_PREFERENCE, VIDEO_FILE_EXTENSION
from streamonitor.downloaders.ffmpeg import getVideoFfmpeg


Expand Down Expand Up @@ -277,7 +277,7 @@ def genOutFilename(self, create_dir=True):
if create_dir:
os.makedirs(folder, exist_ok=True)
now = datetime.now()
filename = os.path.join(folder, self.username + '-' + str(now.strftime("%Y%m%d-%H%M%S")) + '.mp4')
filename = os.path.join(folder, self.username + '-' + str(now.strftime("%Y%m%d-%H%M%S")) + VIDEO_FILE_EXTENSION)
return filename

def export(self):
Expand Down

0 comments on commit f90ac52

Please sign in to comment.