Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How add metadata without creating a new file ? #5

Closed
cyr06 opened this issue Nov 13, 2018 · 2 comments
Closed

How add metadata without creating a new file ? #5

cyr06 opened this issue Nov 13, 2018 · 2 comments

Comments

@cyr06
Copy link

cyr06 commented Nov 13, 2018

How add metadata without creating a new file (~ "save" instead of "save as") ?
I use that code and I get a show (1).mp4

from subler import Subler
from subler.tools import AtomCollection
metadata = AtomCollection()
metadata['TV Show'] = 'show_name'
s = Subler('/Users/me/show.mp4', metadata=metadata.atoms)
s.tag()
@moogar0880
Copy link
Owner

Hey, so I've played around with this a bit and unfortunately it doesn't look like the SublerCLI provides that functionality. It looks like it will always create a <title> (1) file if the source and destination files have the same name. My guess is that it's a limitation of whatever API it's calling under the covers.

I'd suggest doing something along these lines

import os
import shutil
from subler import Subler
from subler.tools import AtomCollection
metadata = AtomCollection()
metadata['TV Show'] = 'show_name'

original_file_name = '/Users/me/show.mp4'
old_file_name = '/Users/me/show.mp4.old'

# move the file to denote it as the "old" file
shutil.move(original_file_name, old_file_name)

s = Subler(old_file_name, dest=original_file_name, metadata=metadata.atoms)
s.tag()

# clean up the un-tagged file
os.remove(old_file_name)

@cyr06
Copy link
Author

cyr06 commented Nov 14, 2018

Thank you for this code which is better that the one I used to get rid of the old file.
I thought I could save some time but I will launch my batch process while I take a nap ;)
Have a good day !

@cyr06 cyr06 closed this as completed Nov 14, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants