Author SHA1 Message Date
Chris A. Bunt 985f4b5235 upgrade audio disc logging capabilities
Enhance the logging methodology for audio discs. If an audio disc is
identified the musicbrainz or cddb disc ID is used as a logging file
name. This makes multipe rip processes easier to identify and
troubleshoot, and puts audio ripping logs in position to be cleaned by
the existing log-cleaning routine.
2017-06-04 23:43:54 -05:00
Chris A. Bunt d7a66d4800 Enhance audio disc logging
Enhanced the logging methodology for audio discs. If an audio disc is
identified the musicbrainz or cddb disc ID is used as a logging file
name. This makes multipe rip processes easier to identify and
troubleshoot, and puts audio ripping logs in position to be cleaned by
the existing log-cleaning routine.
2017-06-04 23:31:38 -05:00
4 changed files with 18 additions and 59 deletions
-33
View File
@@ -1,33 +0,0 @@
2017-06-05 - Chris Bunt
Automatic Ripping Mahcine (ARM) Project
Development Branch: dep-omdbapi-key
Scope: Add the ability to query omdbapi using thier new API key structure. As
of late May 2017, a change in policy at omdbapi requires the use of a key
to perform queries. At this time, it is undetermined whether free (as in beer)
access will be made again available, but if it is, it appears that it will
still require a key.
This branch will update the code making the queries to get movie by type, which
is used by the ARM to determine whether a video disc is a "movie" or a
"TV series," (or potentially any other type of video).
API Key for OMDBAPI.com (Not sure how private this should be)
OMDb API: http://www.omdbapi.com/?i=tt3896198&apikey=38d39b96
Poster API: http://img.omdbapi.com/?i=tt3896198&h=600&apikey=38d39b96
KEY: 38d39b96
Generated URL:
http://www.omdbapi.com/?t={0}&y={1}&plot=short&r=json&apikey={omdb_api_key
http://www.omdbapi.com/?t="true grit"&plot=short&4=json&apikey=38d39b96
video name example "Raising Arizona (1999)"
Files affected:
config.sample -- will likely need a new variable to support the eu's API key,
this will be modelled off the exisitng API key methodology used for existing
keyed tools like pushbullet and (presumably) MakeMKV.
getvideotype.py -- primary python script that gets the video type.
identify.sh -- Primary script that calls video type. Altered to pass the API
key to getvideotype.py as part of the request
+8 -10
View File
@@ -158,21 +158,19 @@ IFTTT_EVENT="arm_event"
PO_USER_KEY=""
PO_APP_KEY=""
# OMDB_API_KEY
# omdbapi.com API Key
# This is the API key for omdbapi.com queries.
# More info at http://omdbapi.com/
# OMDB_API_KEY=""
OMDB_API_KEY="38d39b96"
# Determine logfile name
# use the label of the DVD/CD or else use empty.log
# this is required for udev events where there is no media available
# such as ejecting the drive
if [ -z "$ID_FS_LABEL" ]; then
LOGFILE="empty.log"
else
if [ -n "$ID_FS_LABEL" ]; then
LOGFILE=${ID_FS_LABEL}".log"
elif [[ -n "$ID_CDROM_MEDIA_TRACK_COUNT_AUDIO" && $(which abcde-musicbrainz-tool) ]]; then
LOGFILE=$(abcde-musicbrainz-tool --device "$DEVNAME" | cut -f1 -d ' ')".log"
elif [[ -n "$ID_CDROM_MEDIA_TRACK_COUNT_AUDIO" && $(which cd-discid) ]]; then
LOGFILE=$(cd-discid "$DEVNAME" | cut -f1 -d ' ')".log"
else
LOGFILE="empty.log"
fi
# Set full logfile path
+8 -13
View File
@@ -12,7 +12,6 @@ def entry():
""" Entry to program, parses arguments"""
parser = argparse.ArgumentParser(description='Get type of dvd--movie or tv series')
parser.add_argument('-t', '--title', help='Title', required=True)
parser.add_argument('-k', '--key', help='API_Key', dest='omdb_api_key', required=True)
return parser.parse_args()
@@ -21,7 +20,6 @@ def getdvdtype():
or a tv series """
dvd_title = args.title
needs_new_year = "false"
omdb_api_key = args.omdb_api_key
try:
year = dvd_title[(dvd_title.rindex('(')):len(dvd_title)]
@@ -40,7 +38,7 @@ def getdvdtype():
if year is None:
year = ""
dvd_type = callwebservice(omdb_api_key, dvd_title_clean, year)
dvd_type = callwebservice(dvd_title_clean, year)
# print (dvd_type)
# handle failures
@@ -48,7 +46,7 @@ def getdvdtype():
if (dvd_type == "fail"):
# first try submitting without the year
dvd_type = callwebservice(omdb_api_key, dvd_title_clean, "")
dvd_type = callwebservice(dvd_title_clean, "")
# print (dvd_type)
if (dvd_type != "fail"):
@@ -60,12 +58,12 @@ def getdvdtype():
if (dvd_title.find("-") > -1):
dvd_title_slice = dvd_title[:dvd_title.find("-")]
dvd_title_slice =cleanupstring(dvd_title_slice)
dvd_type = callwebservice(omdb_api_key, dvd_title_slice)
dvd_type = callwebservice(dvd_title_slice)
# if still fail, then try slicing off the last word in a loop
while dvd_type == "fail" and dvd_title_clean.count('+') > 0:
dvd_title_clean = dvd_title_clean.rsplit('+', 1)[0]
dvd_type = callwebservice(omdb_api_key, dvd_title_clean)
dvd_type = callwebservice(dvd_title_clean)
if needs_new_year == "true":
#pass the new year back to bash to handle
@@ -79,16 +77,13 @@ def cleanupstring(string):
string = string.strip()
return re.sub('[_ ]',"+",string)
def callwebservice(omdb_api_key, dvd_title, year=""):
def callwebservice(dvd_title, year=""):
""" Queries OMDbapi.org for title information and parses if it's a movie
or a tv series """
print (dvd_title)
print (year)
print (omdb_api_key)
# print (dvd_title)
try:
# dvd_title_info_json = urllib.request.urlopen("http://www.omdbapi.com/?t={0}&y={1}&plot=short&r=json".format(dvd_title, year)).read()
dvd_title_info_json = urllib.request.urlopen("http://www.omdbapi.com/?t={1}&y={2}&plot=short&r=json&apikey={0}".format(omdb_api_key, dvd_title, year)).read()
dvd_title_info_json = urllib.request.urlopen("http://www.omdbapi.com/?t={0}&y={1}&plot=short&r=json".format(dvd_title, year)).read()
except:
return "fail"
else:
@@ -103,4 +98,4 @@ def callwebservice(omdb_api_key, dvd_title, year=""):
args = entry()
dvd_type = getdvdtype()
print(dvd_type)
print(dvd_type)
+2 -3
View File
@@ -70,9 +70,8 @@ if [ "$ID_FS_TYPE" == "udf" ]; then
fi
if [ $HAS_NICE_TITLE == true ]; then
# VTYPE=$(/opt/arm/getvideotype.py -t "${VIDEO_TITLE}" 2>&1)
VTYPE=$(/opt/arm/getvideotype.py -t "${VIDEO_TITLE}" -k "${OMDB_API_KEY}" 2>&1)
VTYPE=$(/opt/arm/getvideotype.py -t "${VIDEO_TITLE}" 2>&1)
#handle year mismath if found
if [[ $VTYPE =~ .*#.* ]]; then
VIDEO_TYPE=$(echo "$VTYPE" | cut -f1 -d#)