Skip to content

Commit

Permalink
Add channel attribute to item
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpapersonic committed Dec 27, 2022
1 parent a8f86e0 commit 4ca9262
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/test_tubeup.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def test_create_archive_org_metadata_from_youtubedl_meta(self):

expected_result = {
'mediatype': 'movies',
'channel': 'http://www.youtube.com/channel/UCWpsozCMdAnfI16rZHQ9XDg',
'creator': 'Video Background',
'collection': 'opensource_movies',
'title': 'Mountain 3 - Video Background HD 1080p',
Expand Down Expand Up @@ -355,6 +356,7 @@ def test_create_archive_org_metadata_from_youtubedl_meta_no_uploader(self):

expected_result = {
'mediatype': 'movies',
'channel': 'http://www.youtube.com/channel/UCWpsozCMdAnfI16rZHQ9XDg',
'creator': 'http://www.youtube.com/channel/UCWpsozCMdAnfI16rZHQ9XDg',
'collection': 'opensource_movies',
'title': 'Mountain 3 - Video Background HD 1080p',
Expand Down Expand Up @@ -392,6 +394,7 @@ def test_create_archive_org_metadata_from_youtubedl_meta_no_date(self):

expected_result = {
'mediatype': 'movies',
'channel': 'http://www.youtube.com/channel/UCWpsozCMdAnfI16rZHQ9XDg',
'creator': 'Video Background',
'collection': 'opensource_movies',
'title': 'Mountain 3 - Video Background HD 1080p',
Expand Down Expand Up @@ -490,6 +493,7 @@ def test_upload_ia(self):
expected_result = (
'youtube-6iRV8liah8A',
{'mediatype': 'movies',
'channel': 'http://www.youtube.com/channel/UCWpsozCMdAnfI16rZHQ9XDg',
'creator': 'Video Background',
'collection': 'opensource_movies',
'title': 'Mountain 3 - Video Background HD 1080p',
Expand Down Expand Up @@ -548,6 +552,7 @@ def test_archive_urls(self):
'youtube-KdsN9YhkDrY',
{'mediatype': 'movies',
'creator': 'RelaxingWorld',
'channel': 'http://www.youtube.com/channel/UCWpsozCMdAnfI16rZHQ9XDg',
'collection': 'opensource_movies',
'title': 'Epic Ramadan - Video Background HD1080p',
'description': ('If you enjoy my work, please consider Subscribe to my NEW '
Expand Down
Empty file.
8 changes: 7 additions & 1 deletion tubeup/TubeUp.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def upload_ia(self, videobasename, custom_meta=None):
vid_meta['display_id']))

# Exit if video download did not complete, don't upload .part files to IA
for ext in ['*.part', '*.f303*', '*.f302*', '*.ytdl', '*.f251*', '*.248*', '*.f247*', '*.temp']:
for ext in ['*.part', '*.f303.*', '*.f302.*', '*.ytdl', '*.f251.*', '*.248.*', '*.f247.*', '*.temp']:
if glob.glob(videobasename + ext):
msg = 'Video download incomplete, re-attempt archival attempt, exiting...'
raise Exception(msg)
Expand Down Expand Up @@ -544,4 +544,10 @@ def create_archive_org_metadata_from_youtubedl_meta(vid_meta):
# powered uploads, per request from archive.org
scanner='TubeUp Video Stream Mirroring Application {}'.format(__version__))

# add channel url if it exists
if 'uploader_url' in vid_meta:
metadata["channel"] = vid_meta["uploader_url"]
elif 'channel_url' in vid_meta:
metadata["channel"] = vid_meta["channel_url"]

return metadata

0 comments on commit 4ca9262

Please sign in to comment.