|
@@ -27,7 +27,7 @@ from lib_stov import stov_exceptions
|
|
|
LOGGER = logging.getLogger("stov")
|
|
|
|
|
|
|
|
|
-def get_ids(conf, url, title=""):
|
|
|
+def get_ids(conf, url, title="", reverse=False):
|
|
|
"""
|
|
|
Retrieves the IDs
|
|
|
:param conf: configuration object
|
|
@@ -36,6 +36,9 @@ def get_ids(conf, url, title=""):
|
|
|
:type url: str
|
|
|
:param title: optional title to match
|
|
|
:type title: str
|
|
|
+ :param reverse: look up a playlist in reverse order to get \
|
|
|
+ the recent videos first
|
|
|
+ :type reverse: bool
|
|
|
:return: video IDs
|
|
|
:rtype: list
|
|
|
"""
|
|
@@ -53,17 +56,24 @@ def get_ids(conf, url, title=""):
|
|
|
video_ids = subprocess.check_output(
|
|
|
[conf.values["youtube-dl"], "--max-downloads",
|
|
|
conf.values["maxvideos"], "--match-title",
|
|
|
- title, "--get-id", url], stderr=stderr)
|
|
|
+ title, "-i", "--get-id", url], stderr=stderr)
|
|
|
except subprocess.CalledProcessError as error_message:
|
|
|
video_ids = error_message.output
|
|
|
else:
|
|
|
- LOGGER.debug(_("Executing command: %s %s %s %s %s"),
|
|
|
+ LOGGER.debug(_("Executing command: %s %s %s %s %s %s"),
|
|
|
conf.values["youtube-dl"], "--max-downloads",
|
|
|
- conf.values["maxvideos"], "--get-id", url)
|
|
|
+ conf.values["maxvideos"], "-i", "--get-id", url)
|
|
|
try:
|
|
|
- video_ids = subprocess.check_output(
|
|
|
- [conf.values["youtube-dl"], "--max-downloads",
|
|
|
- conf.values["maxvideos"], "--get-id", url], stderr=stderr)
|
|
|
+ if reverse:
|
|
|
+ video_ids = subprocess.check_output(
|
|
|
+ [conf.values["youtube-dl"], "--max-downloads",
|
|
|
+ conf.values["maxvideos"], "-i", "--playlist-reverse",
|
|
|
+ "--get-id", url], stderr=stderr)
|
|
|
+ else:
|
|
|
+ video_ids = subprocess.check_output(
|
|
|
+ [conf.values["youtube-dl"], "--max-downloads",
|
|
|
+ conf.values["maxvideos"],
|
|
|
+ "-i", "--get-id", url], stderr=stderr)
|
|
|
except subprocess.CalledProcessError as error_message:
|
|
|
video_ids = error_message.output
|
|
|
video_ids = video_ids.decode(sys.stdout.encoding).strip()
|