mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
Merge branch 'master' of https://github.com/spaam/svtplay-dl.git
# By Johan Andersson (7) and qnorsten (1) # Via Johan Andersson * 'master' of https://github.com/spaam/svtplay-dl.git: New release 1.1 Update makefile version number makefile: fix a sed error diff_man: detect extented regex for sed Add new agruments to pod file main: move all-subtitles to the rest of subtitles agruments Add a silent-semi argument get_one_media: added missing checks if subtitles exists before trying to print url using -g
This commit is contained in:
commit
4b9cd2a954
4
Makefile
4
Makefile
@ -4,7 +4,7 @@ all: svtplay-dl
|
||||
release clean_releasedir $(RELEASE_DIR)
|
||||
|
||||
# These variables describe the latest release:
|
||||
VERSION = 1.0
|
||||
VERSION = 1.1
|
||||
LATEST_RELEASE = $(VERSION)
|
||||
|
||||
# If we build a new release, this is what it will be called:
|
||||
@ -75,7 +75,7 @@ clean_releasedir:
|
||||
|
||||
release: $(RELEASE_DIR) release-test
|
||||
set -e; cd $(RELEASE_DIR) && \
|
||||
sed -i -re 's/^(__version__ = ).*/\1"$(NEW_RELEASE)"/' lib/svtplay_dl/__init__.py;\
|
||||
sed -i -re 's/^\(__version__ = \).*/\1"$(NEW_RELEASE)"/' lib/svtplay_dl/__init__.py;\
|
||||
git add Makefile lib/svtplay_dl/__init__.py; \
|
||||
git commit -m "New release $(NEW_RELEASE)";
|
||||
(cd $(RELEASE_DIR) && git format-patch --stdout HEAD^) | git am
|
||||
|
@ -49,7 +49,7 @@ from svtplay_dl.service.viaplay import Viaplay
|
||||
from svtplay_dl.service.vimeo import Vimeo
|
||||
from svtplay_dl.service.youplay import Youplay
|
||||
|
||||
__version__ = "1.0"
|
||||
__version__ = "1.1"
|
||||
|
||||
sites = [
|
||||
Aftonbladet,
|
||||
@ -137,12 +137,14 @@ class Options(object):
|
||||
self.remux = False
|
||||
self.get_all_subtitles = False
|
||||
self.get_raw_subtitles = False
|
||||
|
||||
self.silent_semi = False
|
||||
|
||||
def get_media(url, options):
|
||||
if "http" not in url[:4]:
|
||||
url = "http://%s" % url
|
||||
|
||||
if options.silent_semi:
|
||||
options.silent = True
|
||||
stream = service_handler(sites, options, url)
|
||||
if not stream:
|
||||
generic = Generic(options, url)
|
||||
@ -279,13 +281,16 @@ def get_one_media(stream, options):
|
||||
log.warning("Cant find ffmpeg/avconv. audio and video is in seperate files. if you dont want this use -P hls or hds")
|
||||
if options.remux:
|
||||
post.remux()
|
||||
if options.silent_semi and stream.finished:
|
||||
log.log(25, "Download of %s was completed" % stream.options.output)
|
||||
|
||||
|
||||
def setup_log(silent, verbose=False):
|
||||
logging.addLevelName(25, "INFO")
|
||||
fmt = logging.Formatter('%(levelname)s: %(message)s')
|
||||
if silent:
|
||||
stream = sys.stderr
|
||||
level = logging.WARNING
|
||||
level = 25
|
||||
elif verbose:
|
||||
stream = sys.stderr
|
||||
level = logging.DEBUG
|
||||
@ -319,6 +324,8 @@ def main():
|
||||
parser.add_option("-s", "--silent",
|
||||
action="store_true", dest="silent", default=False,
|
||||
help="be less verbose")
|
||||
parser.add_option("--silent-semi", action="store_true",
|
||||
dest="silent_semi", default=False, help="only show a message when the file is downloaded")
|
||||
parser.add_option("-v", "--verbose",
|
||||
action="store_true", dest="verbose", default=False,
|
||||
help="explain what is going on")
|
||||
@ -336,6 +343,8 @@ def main():
|
||||
action="store_true", help="download only subtitle if its used with -S")
|
||||
parser.add_option("--require-subtitle", dest="require_subtitle", default=False,
|
||||
action="store_true", help="download only if a subtitle is available")
|
||||
parser.add_option("--all-subtitles", dest="get_all_subtitles", default=False, action="store_true",
|
||||
help="Download all available subtitles for the video")
|
||||
parser.add_option("-u", "--username", default=None,
|
||||
help="username")
|
||||
parser.add_option("-p", "--password", default=None,
|
||||
@ -363,10 +372,6 @@ def main():
|
||||
help="If two streams have the same quality, choose the one you prefer")
|
||||
parser.add_option("--remux", dest="remux", default=False, action="store_true",
|
||||
help="Remux from one container to mp4 using ffmpeg or avconv")
|
||||
parser.add_option("--all-subtitles", dest="get_all_subtitles", default=False, action="store_true",
|
||||
help="Download all available subtitles for the video")
|
||||
parser.add_option("--raw-subtitles", dest="get_raw_subtitles", default=False, action="store_true",
|
||||
help="Also download the subtitles in their native format")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
if not args:
|
||||
@ -381,6 +386,8 @@ def main():
|
||||
if options.require_subtitle:
|
||||
options.subtitle = True
|
||||
options = mergeParserOption(Options(), options)
|
||||
if options.silent_semi:
|
||||
options.silent = True
|
||||
setup_log(options.silent, options.verbose)
|
||||
|
||||
if options.flexibleq and not options.quality:
|
||||
@ -405,6 +412,7 @@ def mergeParserOption(options, parser):
|
||||
options.flexibleq = parser.flexibleq
|
||||
options.list_quality = parser.list_quality
|
||||
options.subtitle = parser.subtitle
|
||||
options.silent_semi = parser.silent_semi
|
||||
options.username = parser.username
|
||||
options.password = parser.password
|
||||
options.thumbnail = parser.thumbnail
|
||||
|
@ -12,21 +12,29 @@ TMPDIR=$(mktemp -d svtplay-man-test-XXXXXX)
|
||||
}
|
||||
trap 'rm -rf "$TMPDIR"' EXIT TERM
|
||||
|
||||
if echo "" | sed -r "" > /dev/null 2>&1 ; then
|
||||
extended_regexp="-r"
|
||||
elif echo "" | sed -E "" > /dev/null 2>&1 ; then
|
||||
extended_regexp="-E"
|
||||
else
|
||||
echo "Cant find extented regex"
|
||||
fi
|
||||
|
||||
# FIXME: *Currently* we don't have any =head3 that doesn't
|
||||
# document an option. This is thus fragile to changes.
|
||||
sed -nre 's/^=head3 //p' svtplay-dl.pod > $TMPDIR/options.man
|
||||
sed $extended_regexp -ne 's/^=head3 //p' svtplay-dl.pod > $TMPDIR/options.man
|
||||
|
||||
./svtplay-dl --help | grep '^ *-' > $TMPDIR/options.help
|
||||
|
||||
# --help specific filtering
|
||||
sed -i -re 's/ .*//' $TMPDIR/options.help
|
||||
sed -i -re 's/ excl.*//' $TMPDIR/options.help
|
||||
sed -i -re 's/^ *//' $TMPDIR/options.help
|
||||
sed -i -re 's/OUTPUT/filename/g' $TMPDIR/options.help
|
||||
sed -i $extended_regexp -e 's/ .*//' $TMPDIR/options.help
|
||||
sed -i $extended_regexp -e 's/ excl.*//' $TMPDIR/options.help
|
||||
sed -i $extended_regexp -e 's/^ *//' $TMPDIR/options.help
|
||||
sed -i $extended_regexp -e 's/OUTPUT/filename/g' $TMPDIR/options.help
|
||||
|
||||
for file in $TMPDIR/options.*; do
|
||||
sed -i -re 's/, / /' $file
|
||||
sed -i -re 's/ / /' $file
|
||||
sed -i $extended_regexp -e 's/, / /' $file
|
||||
sed -i $extended_regexp -e 's/ / /' $file
|
||||
|
||||
# Normalize order of --help -h vs -h --help
|
||||
# "--help -h" => "-h --help"
|
||||
|
@ -47,6 +47,10 @@ Enable support for live streams. (rtmp based ones)
|
||||
|
||||
Be less verbose.
|
||||
|
||||
=head3 --silent-semi
|
||||
|
||||
only show a message when the file is downloaded
|
||||
|
||||
=head3 --verbose -v
|
||||
|
||||
Explain what is going on, including HTTP requests and other useful
|
||||
@ -77,6 +81,10 @@ Download only subtitle if its used with -S.
|
||||
|
||||
Download only if a subtitle is available
|
||||
|
||||
=head3 --all-subtitles
|
||||
|
||||
Download all available subtitles for the video
|
||||
|
||||
=head3 --username=USERNAME -u USERNAME
|
||||
|
||||
Username, if the service requires authentication.
|
||||
|
Loading…
Reference in New Issue
Block a user