3 Commits

Author SHA1 Message Date
Chris A. Bunt
c0b5cdfaf6 removed legacy code
removed deprecated timesamp code
2017-06-04 21:39:41 -05:00
Chris A. Bunt
2cc6d55918 Updated methodology of timestamp entry
Updated the methodology used to generate timestamp (using $(command)
rather than `command`)
2017-06-04 21:37:34 -05:00
Chris A. Bunt
b323542dd1 non-audo-cd bug fix and add timestamp to logs
Added a timestamp to each logfile (line 20) and corrected a condition
where I was getting a syntax error reported to root@localhost (email)
when a non-audio CD is inserted.
2017-06-04 20:10:14 -05:00
4 changed files with 12 additions and 57 deletions

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

View File

@@ -158,13 +158,6 @@ 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

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)

View File

@@ -17,6 +17,7 @@ mkdir -p "$LOGPATH"
# excludes sensative parameters
# shellcheck disable=SC2129
echo "*** Start config parameters ****" >> "$LOG"
echo -e "\tTimestamp: $(date -R)" >> "$LOG"
# shellcheck disable=SC2002
cat "$ARM_CONFIG"|sed '/^[#;].*$/d;/^$/d;/if/d;/^ /d;/^else/d;/^fi/d;/KEY=/d;/PASSWORD/d' >> "$LOG"
echo "*** End config parameters ****" >> "$LOG"
@@ -70,9 +71,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#)
@@ -107,7 +107,7 @@ if [ "$ID_FS_TYPE" == "udf" ]; then
fi
elif (("$ID_CDROM_MEDIA_TRACK_COUNT_AUDIO" > 0 )); then
elif [ -n "$ID_CDROM_MEDIA_TRACK_COUNT_AUDIO" ]; then
echo "identified audio" >> "$LOG"
abcde -d "$DEVNAME"