git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ../picard/ui/options/renaming.py
modified: ../picard/util/emptydir.py
no changes added to commit (use "git add" and/or "git commit -a")
git rev-parse HEAD
0486ac27160a93b5925b64b36b9d40f28fb61600
git diff origin/head
diff --git a/.gitignore b/.gitignore
index 193258b4..06e057f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,4 @@ win-version-info.txt
*~
appledev.p12
build.cfg
+/picbld
diff --git a/picard/file.py b/picard/file.py
index 2917747d..3c1f1f63 100644
--- a/picard/file.py
+++ b/picard/file.py
@@ -420,27 +420,59 @@ class File(QtCore.QObject, Item):
# os.path.realpath can fail if cwd doesn't exist
return new_path
+
def _rename(self, old_filename, metadata):
new_filename, ext = os.path.splitext(
self.make_filename(old_filename, metadata))
-
+
if old_filename == new_filename + ext:
return old_filename
-
- new_dirname = os.path.dirname(new_filename)
- if not os.path.isdir(new_dirname):
- os.makedirs(new_dirname)
- tmp_filename = new_filename
- i = 1
- while (not pathcmp(old_filename, new_filename + ext)
- and os.path.exists(new_filename + ext)):
- new_filename = "%s (%d)" % (tmp_filename, i)
- i += 1
+
+ tmp_directory,tmp_filename = os.path.split(new_filename)
+ new_directory = tmp_directory
+ i = 0
+ file_found = True
+ while not pathcmp(old_filename, new_filename + ext) and file_found:
+ if not os.path.isdir(new_directory):
+ os.makedirs(new_directory)
+
+ if os.path.exists(new_filename + ext):
+ i += 1
+ new_directory = "%s (%d)" % (tmp_directory, i)
+ new_filename = os.path.join(new_directory, tmp_filename)
+ else:
+ file_found = False
+
new_filename = new_filename + ext
log.debug("Moving file %r => %r", old_filename, new_filename)
shutil.move(old_filename, new_filename)
return new_filename
+
+############ Original Code #############
+# def _rename(self, old_filename, metadata):
+# new_filename, ext = os.path.splitext(
+# self.make_filename(old_filename, metadata))
+#
+# if old_filename == new_filename + ext:
+# return old_filename
+#
+# new_dirname = os.path.dirname(new_filename)
+# if not os.path.isdir(new_dirname):
+# os.makedirs(new_dirname)
+# tmp_filename = new_filename
+# i = 1
+# while (not pathcmp(old_filename, new_filename + ext)
+# and os.path.exists(new_filename + ext)):
+# new_filename = "%s (%d)" % (tmp_filename, i)
+# i += 1
+# new_filename = new_filename + ext
+# log.debug("Moving file %r => %r", old_filename, new_filename)
+# shutil.move(old_filename, new_filename)
+# return new_filename~
+############# Original Code #############
+
+
def _save_images(self, dirname, metadata):
"""Save the cover images to disk."""
if not metadata.images:
diff --git a/picard/ui/options/renaming.py b/picard/ui/options/renaming.py
index c42f6473..d790b56b 100644
--- a/picard/ui/options/renaming.py
+++ b/picard/ui/options/renaming.py
@@ -239,25 +239,32 @@ class RenamingOptionsPage(OptionsPage):
# self.ui.file_naming_format.setCursorPosition(0)
def example_1(self):
- file = File("ticket_to_ride.mp3")
+ file = File("Ticket_to_Ride.mp3")
file.state = File.NORMAL
file.metadata['album'] = 'Help!'
- file.metadata['title'] = 'Ticket to Ride'
file.metadata['artist'] = 'The Beatles'
- file.metadata['artistsort'] = 'Beatles, The'
+ file.metadata['title'] = 'Ticket to Ride'
+ file.metadata['date'] = '1965-08-06'
file.metadata['albumartist'] = 'The Beatles'
- file.metadata['albumartistsort'] = 'Beatles, The'
file.metadata['tracknumber'] = '7'
file.metadata['totaltracks'] = '14'
- file.metadata['discnumber'] = '1'
file.metadata['totaldiscs'] = '1'
- file.metadata['date'] = '1965-08-06'
+ file.metadata['discnumber'] = '1'
+ file.metadata['artistsort'] = 'Beatles, The'
+ file.metadata['albumartistsort'] = 'Beatles, The'
+ file.metadata['media'] = 'Vinyl'
+ file.metadata['label'] = 'Apple Records'
file.metadata['releasetype'] = ['album', 'soundtrack']
file.metadata['~primaryreleasetype'] = ['album']
file.metadata['~secondaryreleasetype'] = ['soundtrack']
- file.metadata['releasestatus'] = 'official'
+ file.metadata['releasestatus'] = 'Official'
+ file.metadata['catalognumber'] = 'M8541'
file.metadata['releasecountry'] = 'US'
file.metadata['~extension'] = 'mp3'
+ file.metadata['~length'] = '4_20'
+ file.metadata['bitrate'] = '256.0'
+ file.metadata['sample_rate'] = '44100'
+ file.metadata['channels'] = '2'
file.metadata['musicbrainz_albumid'] = '2c053984-4645-4699-9474-d2c35c227028'
file.metadata['musicbrainz_albumartistid'] = 'b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d'
file.metadata['musicbrainz_artistid'] = 'b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d'
@@ -266,28 +273,34 @@ class RenamingOptionsPage(OptionsPage):
return file
def example_2(self):
- file = File("track05.mp3")
+ file = File("Classical_Crass.mp3")
file.state = File.NORMAL
- file.metadata['album'] = "Coup d'État, Volume 1: Ku De Ta / Prologue"
- file.metadata['title'] = "I've Got to Learn the Mambo"
- file.metadata['artist'] = "Snowboy feat. James Hunter"
- file.metadata['artistsort'] = "Snowboy feat. Hunter, James"
+ file.metadata['album'] = "Compilation Album"
+ file.metadata['title'] = "Track Title"
+ file.metadata['artist'] = "Artist feat. Last, First"
+ file.metadata['artistsort'] = "Artist feat. First, Last"
file.metadata['albumartist'] = config.setting['va_name']
file.metadata['albumartistsort'] = config.setting['va_name']
+ file.metadata['media'] = 'Vinyl'
file.metadata['tracknumber'] = '5'
file.metadata['totaltracks'] = '13'
file.metadata['discnumber'] = '2'
file.metadata['totaldiscs'] = '2'
- file.metadata['discsubtitle'] = "Beat Up"
+ file.metadata['label'] = 'Bootleg Records'
+ file.metadata['discsubtitle'] = "Disc Subtitle"
file.metadata['date'] = '2005-07-04'
file.metadata['releasetype'] = ['album', 'compilation']
file.metadata['~primaryreleasetype'] = 'album'
file.metadata['~secondaryreleasetype'] = 'compilation'
- file.metadata['releasestatus'] = 'official'
+ file.metadata['releasestatus'] = 'Release Status'
file.metadata['releasecountry'] = 'AU'
+ file.metadata['~extension'] = 'mp3'
+ file.metadata['~length'] = '10_40'
+ file.metadata['bitrate'] = '256.0'
+ file.metadata['sample_rate'] = '44100'
+ file.metadata['channels'] = '2'
file.metadata['compilation'] = '1'
file.metadata['~multiartist'] = '1'
- file.metadata['~extension'] = 'mp3'
file.metadata['musicbrainz_albumid'] = '4b50c71e-0a07-46ac-82e4-cb85dc0c9bdd'
file.metadata['musicbrainz_recordingid'] = 'b3c487cb-0e55-477d-8df3-01ec6590f099'
file.metadata['musicbrainz_releasetrackid'] = 'f8649a05-da39-39ba-957c-7abf8f9012be'
diff --git a/picard/util/__init__.py b/picard/util/__init__.py
index 2c032c43..2e0cbd25 100644
--- a/picard/util/__init__.py
+++ b/picard/util/__init__.py
@@ -120,11 +120,11 @@ def format_time(ms, display_zero=False):
duration_seconds = round(ms / 1000)
if duration_seconds < 3600:
minutes, seconds = divmod(duration_seconds, 60)
- return "%d:%02d" % (minutes, seconds)
+ return "%dm%02ds" % (minutes, seconds)
else:
hours, remainder = divmod(duration_seconds, 3600)
minutes, seconds = divmod(remainder, 60)
- return "%d:%02d:%02d" % (hours, minutes, seconds)
+ return "%dh%02dm%02ds" % (hours, minutes, seconds)
def sanitize_date(datestr):
diff --git a/picard/util/emptydir.py b/picard/util/emptydir.py
index 1cd7d11c..beaaae2d 100644
--- a/picard/util/emptydir.py
+++ b/picard/util/emptydir.py
@@ -29,7 +29,7 @@ from picard.util import get_qt_enum
# Files not considered relevant for a directory. If a directory has only
# some of these files inside it is still considered empty and can be deleted.
-JUNK_FILES = set([".DS_Store", "desktop.ini", "Desktop.ini", "Thumbs.db"])
+JUNK_FILES = set([".DS_Store", "desktop.ini", "Desktop.ini", "Thumbs.db", "Back.jpg", "cover.jpg", "Cover.jpg", "Folder.jpg", "Front.jpg", "Mini.jpg"])
# Special file system locations Picard should never delete.
PROTECTED_DIRECTORIES = set()
The build works with the scripts replaced. I thought I’d done that previously, …guess not.
The package building still terminates with the missing library, and there is nothing in dist.
python3 setup.py build
/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
iMac-Pro:dist tdiaz$ cd ./.
iMac-Pro:dist tdiaz$ cd ..
iMac-Pro:picard tdiaz$ pyinstaller --noconfirm --clean picard.spec
38 INFO: PyInstaller: 3.5
38 INFO: Python: 3.7.4
43 INFO: Platform: Darwin-18.2.0-x86_64-i386-64bit
45 INFO: UPX is not available.
45 INFO: Removing temporary files and cleaning cache in /Users/tdiaz/Library/Application Support/pyinstaller
68 INFO: Extending PYTHONPATH with paths
['/Users/tdiaz/Merlin/picard', '/Users/tdiaz/Merlin/picard/picard']
68 INFO: checking Analysis
68 INFO: Building Analysis because Analysis-00.toc is non existent
68 INFO: Initializing module dependency graph...
69 INFO: Initializing module graph hooks...
74 INFO: Analyzing base_library.zip ...
2151 INFO: running Analysis Analysis-00.toc
2155 INFO: Caching module hooks...
2168 INFO: Analyzing tagger.py
3496 INFO: Loading module hooks...
3496 INFO: Loading module hook "hook-encodings.py"...
3538 INFO: Loading module hook "hook-pydoc.py"...
3538 INFO: Loading module hook "hook-PyQt5.py"...
3652 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
3662 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
3677 INFO: Loading module hook "hook-PyQt5.QtMultimedia.py"...
3698 INFO: Loading module hook "hook-PyQt5.QtNetwork.py"...
3710 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
3738 INFO: Loading module hook "hook-xml.py"...
3934 INFO: Looking for ctypes DLLs
3951 INFO: Analyzing run-time hooks ...
3954 INFO: Including run-time hook 'pyi_rth_pyqt5.py'
3959 INFO: Looking for dynamic libraries
4133 INFO: Looking for eggs
4133 INFO: Using Python library /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Python
4136 INFO: Warnings written to /Users/tdiaz/Merlin/picard/build/picard/warn-picard.txt
4163 INFO: Graph cross-reference written to /Users/tdiaz/Merlin/picard/build/picard/xref-picard.html
4173 INFO: Appending 'binaries' from .spec
Unable to find "libdiscid.0.dylib" when adding binary and data files.