-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcallbacks.py
More file actions
executable file
·49 lines (41 loc) · 1.44 KB
/
Copy pathcallbacks.py
File metadata and controls
executable file
·49 lines (41 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
import time
import os
import argparse
import sys
import json
import subprocess
class Logger(object):
def __init__(self, filename="/edm.log"):
self.terminal = sys.stdout
self.log = open(filename, "a")
def write(self, message):
self.terminal.write(message)
self.log.write(message)
#sys.stdout = Logger("/edm.log")
#print "Hello world !" # this is should be saved in yourlogfilename.txt
parser = argparse.ArgumentParser(description='RDS Setting Application')
parser.add_argument('-t','--type', help='Input station name (8 characters max)', required=False)
parser.add_argument('-l','--list',help='Song name',action='store_true')
parser.add_argument('-d','--data',help='Song name')
args = parser.parse_args()
if args.list:
#Tell the plugin that we should be registered for media
print "media"
if args.type:
# Look for our type of plugin, doubt this is even needed at all
mytypearg = args.type
#print "My type args: %s" %mytypearg
if args.data:
#get the json string from FPP
mydataarg = args.data
print "My data args: %s" %mydataarg
data = json.loads(mydataarg)
title = data['title']
# print "Title: %s" %title
os.chdir("/home/fpp/media/plugins/edmrds/")
directory = os.getcwd()
# print "Directory: %s" %directory
#from subprocess import call
#call(["rds-song.py", "-s %title"])
subprocess.call(['/home/fpp/media/plugins/edmrds/rds-song.py', '-s', title])