aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Kanich <kaytwo@gmail.com>2023-02-03 10:33:51 -0600
committerChris Kanich <kaytwo@gmail.com>2023-02-03 10:33:51 -0600
commit18466312ff5b114f9d79f1282e12a386feb1edf7 (patch)
tree97cf954e23f6a0cb03b2086522e55dc6d55ddf05
parentupgraded yt-dlp (diff)
downloadmetube-18466312ff5b114f9d79f1282e12a386feb1edf7.tar.gz
metube-18466312ff5b114f9d79f1282e12a386feb1edf7.tar.bz2
metube-18466312ff5b114f9d79f1282e12a386feb1edf7.zip
unique downloads of identically named videos
-rw-r--r--app/ytdl.py2
-rw-r--r--ui/src/app/downloads.service.ts12
2 files changed, 7 insertions, 7 deletions
diff --git a/app/ytdl.py b/app/ytdl.py
index 0bafc91..266de10 100644
--- a/app/ytdl.py
+++ b/app/ytdl.py
@@ -170,7 +170,7 @@ class PersistentQueue:
return sorted(shelf.items(), key=lambda item: item[1].timestamp)
def put(self, value):
- key = value.info.id
+ key = value.info.url
self.dict[key] = value
with shelve.open(self.path, 'w') as shelf:
shelf[key] = value.info
diff --git a/ui/src/app/downloads.service.ts b/ui/src/app/downloads.service.ts
index 77d2fed..e1a134d 100644
--- a/ui/src/app/downloads.service.ts
+++ b/ui/src/app/downloads.service.ts
@@ -52,20 +52,20 @@ export class DownloadsService {
});
socket.fromEvent('added').subscribe((strdata: string) => {
let data: Download = JSON.parse(strdata);
- this.queue.set(data.id, data);
+ this.queue.set(data.url, data);
this.queueChanged.next(null);
});
socket.fromEvent('updated').subscribe((strdata: string) => {
let data: Download = JSON.parse(strdata);
- let dl: Download = this.queue.get(data.id);
+ let dl: Download = this.queue.get(data.url);
data.checked = dl.checked;
data.deleting = dl.deleting;
- this.queue.set(data.id, data);
+ this.queue.set(data.url, data);
});
socket.fromEvent('completed').subscribe((strdata: string) => {
let data: Download = JSON.parse(strdata);
- this.queue.delete(data.id);
- this.done.set(data.id, data);
+ this.queue.delete(data.url);
+ this.done.set(data.url, data);
this.queueChanged.next(null);
this.doneChanged.next(null);
});
@@ -110,7 +110,7 @@ export class DownloadsService {
public delByFilter(where: string, filter: (dl: Download) => boolean) {
let ids: string[] = [];
- this[where].forEach((dl: Download) => { if (filter(dl)) ids.push(dl.id) });
+ this[where].forEach((dl: Download) => { if (filter(dl)) ids.push(dl.url) });
return this.delById(where, ids);
}
}
bgstack15