[SCM] morituri/master: add an example calculating crc's from a cue file
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:08:43 UTC 2014
The following commit has been merged in the master branch:
commit fc0d953138f1bf833e02c42d5a5aaf445ef89e30
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Mon Mar 2 08:46:41 2009 +0000
add an example calculating crc's from a cue file
diff --git a/examples/readcue.py b/examples/ARcue.py
similarity index 57%
copy from examples/readcue.py
copy to examples/ARcue.py
index 05162c1..69fdb26 100644
--- a/examples/readcue.py
+++ b/examples/ARcue.py
@@ -20,15 +20,42 @@
# You should have received a copy of the GNU General Public License
# along with morituri. If not, see <http://www.gnu.org/licenses/>.
+import os
import sys
from morituri.image import cue
+from morituri.common import task
+
+import gobject
+gobject.threads_init()
def main(path):
cuefile = cue.Cue(path)
cuefile.parse()
- print cuefile.tracks
+ for track in cuefile.tracks:
+ index = track._indexes[1]
+ file = index[1]
+
+ # find an actual potential file
+ crctask = None
+
+ # .cue FILE statements have Windows-style path separators
+ path = os.path.join(*file.path.split('\\'))
+ noext, _ = os.path.splitext(path)
+ for ext in ['wav', 'flac']:
+ path = '%s.%s' % (noext, ext)
+ if os.path.exists(path):
+ crctask = task.CRCTask(path)
+
+ if not crctask:
+ print 'error: path %s not found' % file.path
+
+ print 'Analyzing', file.path
+ runner = task.SyncRunner(crctask)
+ runner.run()
+
+ print "%08x" % crctask.crc
path = 'test.cue'
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list