New issue

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

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

Already on GitHub? Sign in to your account

plugins: add a plugin to export a playlist to a folder #2307

Merged
merged 8 commits into from Mar 11, 2017

Conversation

Projects
None yet
2 participants
@ptitjes
Collaborator

ptitjes commented Mar 8, 2017

This is a rough cut.
Please review and comment as to make it better.

@ptitjes ptitjes requested review from lazka and declension Mar 9, 2017

@declension

This comment has been minimized.

Member

declension commented Mar 10, 2017

@ptitjes I'll try to have a look tonight.

(FYI this kind of feature (albeit a less pretty version) can often be achieved by the Custom Commands plugin)

@ptitjes

This comment has been minimized.

Collaborator

ptitjes commented Mar 10, 2017

@declension Thx.

FYI this kind of feature (albeit a less pretty version) can often be achieved by the Custom Commands plugin

I see. I did not this Custom Commands feature. But indeed, I'm glad to be able to select the destination folder and change the pattern at export :)

@declension

A few comments inline but generally LGTM

pattern_label.set_xalign(0.0)
box.pack_start(pattern_label, True, True, 0)
self.pattern_entry = Gtk.Entry(text=pattern)

This comment has been minimized.

@declension

declension Mar 11, 2017

Member

a qltk.UndoEntry is slightly nicer IMO, or even ValidatingEntry here.

This comment has been minimized.

@ptitjes

ptitjes Mar 11, 2017

Collaborator

Looking at the PatternCompiler/PatternParser/PatternLexer trio, I fail to see where it can fail. They seem to be bullet-proof even with ill-written patterns. What would validate a ValidatingEntry then ?

This comment has been minimized.

@declension

declension Mar 11, 2017

Member

Yeah that logic has changed a lot now and is more resilient to user errors (i.e. assumes more things are just text now). Probably needs some rethought, but there are too many use cases in the wild now for significant changes without breaking lots of people's set ups.

Anyway I found you can usually break it with # pretty easily - <#foo>

box.pack_start(destination_label, True, True, 0)
frame = Gtk.Frame()
self.directory_chooser = \

This comment has been minimized.

@declension

declension Mar 11, 2017

Member

FYI we generally try to avoid backslash continuations (some discussion on alternatives, though the PEP itself was rejected: https://www.python.org/dev/peps/pep-3125/)

self.set_response_sensitive(Gtk.ResponseType.OK, has_directory)
pattern_text = self.pattern_entry.get_text()
has_pattern = pattern_text != ""

This comment has been minimized.

@declension

declension Mar 11, 2017

Member

FYI it's generally considered more Pythonic to use has_pattern = bool(pattern_text), or in the negative case just not pattern_text (also deals with None, etc)

class Config(object):
_config = PluginConfig(__name__)
DEFAULT_PATTERN = "<artist> - <title>"

This comment has been minimized.

@declension

declension Mar 11, 2017

Member

I recommend perhaps using a tied tag "<artist~title>" as it works better if is either is missing (e.g. in Classical music 0004. - - Sonata K.380.flac")
...unless those filenames themselves needs parsing by something strict I guess, but this is probably not the default case...

hbox.set_border_width(6)
label = Gtk.Label(label=_("Default filename pattern:"))
hbox.pack_start(label, False, True, 0)
entry = Gtk.Entry()

This comment has been minimized.

@declension

declension Mar 11, 2017

Member

This one more so even perhaps (custom Entry)

ptitjes added some commits Mar 11, 2017

export_to_folder: fix python code and style patterns and use UndoEntry
* fix som python code and style patterns
* use UndoEntry for pattern entry
* set a better default filename pattern

@declension declension merged commit 3a43d0a into quodlibet:master Mar 11, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@declension

This comment has been minimized.

Member

declension commented Mar 11, 2017

Thanks

@ptitjes

This comment has been minimized.

Collaborator

ptitjes commented Mar 11, 2017

Thank you.

@ptitjes ptitjes deleted the ptitjes:export-to-folder branch Mar 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment