Initial commit
This commit is contained in:
commit
bb01952895
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# cue_to_meta
|
||||||
|
|
||||||
|
Takes the CUE format written by e.g. Mixxx's recording feature, and
|
||||||
|
converts it to the metadata format expected by aNONradio's "podcast"
|
||||||
|
system.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
`./cue_to_meta filename.cue` will parse `filename.cue` and write
|
||||||
|
`filename.meta` in meta format.
|
||||||
|
|
||||||
|
## Bugs
|
||||||
|
|
||||||
|
Assumes the show is one hour or less in length.
|
||||||
|
|
||||||
|
## Author/License
|
||||||
|
|
||||||
|
Mark Cornick <mcornick@sdf.org> under the MIT license.
|
55
cue_to_meta.py
Executable file
55
cue_to_meta.py
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""Converts a CUE file to the meta format expected by aNONradio."""
|
||||||
|
|
||||||
|
# Copyright (c) 2022 Mark Cornick
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
# copy of this software and associated documentation files (the
|
||||||
|
# "Software"), to deal in the Software without restriction, including
|
||||||
|
# without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
# permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
# the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included
|
||||||
|
# in all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
cue_file = sys.argv[1]
|
||||||
|
meta_file = re.sub(r"cue$", "meta", cue_file)
|
||||||
|
|
||||||
|
with open(cue_file) as f:
|
||||||
|
cue = f.readlines()
|
||||||
|
|
||||||
|
title = None
|
||||||
|
performer = None
|
||||||
|
timestamp = None
|
||||||
|
|
||||||
|
with open(meta_file, "w") as f:
|
||||||
|
for line in cue:
|
||||||
|
title_re = re.search(r'^ TITLE "(.*)"$', line)
|
||||||
|
performer_re = re.search(r'^ PERFORMER "(.*)"$', line)
|
||||||
|
index_re = re.search(r"^ INDEX 01 (.*)$", line)
|
||||||
|
if title_re:
|
||||||
|
title = title_re[1]
|
||||||
|
if performer_re:
|
||||||
|
performer = performer_re[1]
|
||||||
|
if index_re:
|
||||||
|
time_re = re.search(r"^(..):(..):..$", index_re[1])
|
||||||
|
timestamp = "00{}{}".format(time_re[1], time_re[2])
|
||||||
|
if title and performer and timestamp:
|
||||||
|
f.write("{}:{} - {}\n".format(timestamp, performer, title))
|
||||||
|
title = None
|
||||||
|
performer = None
|
||||||
|
timestamp = None
|
Loading…
Reference in New Issue
Block a user