Skip to content

Commit

Permalink
Merge pull request #3 from fetzerch/pr3
Browse files Browse the repository at this point in the history
Python 3
  • Loading branch information
fetzerch committed Oct 18, 2015
2 parents f07b9c3 + 6ff699e commit c19ea58
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 249 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,30 @@ Besides audio files, sync_music is also able to export M3U playlists to
the destination folder. Absolute paths are hereby replaced with relative
paths in addition to the FAT32 filename adaptations.


Dependencies
------------
- Python 2.7
- Python Audio Tools (for transcoding to MP3)
- Mutagen >= 1.22 (for tag manipulation)

- Python 3.4
- Python Audio Tools >= 3.0 (for transcoding to MP3)
- Mutagen >= 1.29 (for tag manipulation)

Installation
------------

pip3 install --process-dependency-links sync_music.zip

Usage
-----

```
$ sync_music --audio-src=<FOLDER> --audio-dest=<FOLDER>
```
sync_music --audio-src=<FOLDER> --audio-dest=<FOLDER>

M3U Playlist syncing can be enabled by specifying the path to the
playlist with the `--playlist-src=<FOLDER>` parameter.

Some media players don't properly support album artist tags, but they do
support the composer field. This restriction can be bypassed by writing
the album artist information into the composer field. This can be
enabled by the `--albumartist-hack`
enabled by the `--albumartist-hack`

Some media players don't properly support disc number tags with tracks numbered
starting with 1 for every disc. The user typically wants to group them by disc
Expand All @@ -57,9 +59,9 @@ track total is removed from the track number field.
Call sync_music with `--help` to get a full list of supported command
line parameters.


License
-------

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def find_version(*file_paths):
'GNU General Public License v2 or later (GPLv2+)',
'Natural Language :: English',
'Operating System :: POSIX',
'Programming Language :: Python :: 2 :: Only',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Multimedia :: Sound/Audio :: Conversion',
],
keywords='music synchronization',
Expand All @@ -71,8 +71,8 @@ def find_version(*file_paths):
"console_scripts": ['sync_music = sync_music.sync_music:main']
},
install_requires=[
'mutagen',
'audiotools',
'mutagen>=1.29',
'audiotools>=3.0',
],
dependency_links=[
'https://github.com/tuffy/python-audio-tools/tarball/v3.0'
Expand Down
8 changes: 6 additions & 2 deletions sync_music.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@
mkdir $WORKSPACE/build
cd $WORKSPACE/sources
mdl $WORKSPACE/sources | tee $WORKSPACE/build/markdownlint.log
tox -e flake8 | tee $WORKSPACE/build/flake8.log
tox -e py27 | tee $WORKSPACE/build/py27.log
tox -e pylint | tee $WORKSPACE/build/pylint.log
# ----- Publisher -------------------------------------------------------------
Expand All @@ -79,9 +81,11 @@
- warnings:
run-always: true
workspace-file-scanners:
- file-pattern: build/markdownlint.log
scanner: markdownlint
- file-pattern: build/flake8.log
scanner: Pep8
- file-pattern: build/py27.log
- file-pattern: build/pylint.log
scanner: PyLint
total-thresholds:
unstable:
Expand Down
8 changes: 4 additions & 4 deletions sync_music/hashdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def load(self):
""" Load hash database to disk """
if os.path.exists(self.path):
print("Loading hash database from %s" % self.path)
hash_file = open(self.path, 'r')
self.database = pickle.load(hash_file)
hash_file = open(self.path, 'rb')
self.database = pickle.load(hash_file, encoding="utf-8")
hash_file.close()
else:
print("Failed to load hash database from %s" % self.path)
Expand All @@ -43,7 +43,7 @@ def store(self):
""" Store hash database to disk """
print("Storing hash database to %s" % self.path)
try:
hash_file = open(self.path, 'w')
hash_file = open(self.path, 'wb')
pickle.dump(self.database, hash_file)
hash_file.close()
except IOError:
Expand All @@ -52,7 +52,7 @@ def store(self):
@classmethod
def get_hash(cls, path):
""" Calculate hash value for the given path """
hash_file = open(path, 'r')
hash_file = open(path, 'rb')
hash_buffer = hash_file.read(4096)
hash_file.close()
return hashlib.md5(hash_buffer).hexdigest()
Loading

0 comments on commit c19ea58

Please sign in to comment.