Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Dap-P

Pages: 1 2 3 [4] 5 6 7
Users / Re: Best Approach to Controlling a Network Device
« on: October 30, 2013, 11:49:21 pm »
Code: [Select]
linuxmce@dcerouter:~/CodingWork/XBMC$ curl -i -X POST -H "Content-Type: application/json" -d "{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetActivePlayers\", \"id\": 1}"
HTTP/1.1 200 OK
Content-Length: 65
Content-Type: application/json
Date: Tue, 29 Oct 2013 23:15:30 GMT


I know a little about capturing data from scripts, this is as i would do this:
playerid=$(curl -i -X POST -H "Content-Type: application/json" -d "{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetActivePlayers\", \"id\": 1}" | grep playerid | awk -F'playerid":' '{print $2}' | awk -F',' '{print $1}')

something like this should capture the player id in a variable called playerid


New update

Added a description to the script,
added the -ss flag, and removed tail -n1
added the Download Url to a variable
in the delete script added a loop, so that it reads all urls, and checks that in the database

In general, would it be wise to add multiple files to the same radiostation? Now i just grab the first one.


Users / Re: Need some dedicated testers.
« on: October 29, 2013, 11:53:48 pm »
Updated pushed...

now if i could remember what i did.

*changed the phone homescreen to make buttons bigger
*added ability to get screenshot to smokey
*added zoom & aspect for video in smokey
*added a fallback screen for mediatypes that dont have a details page implemented yet.
*added support for browsing photos.

*found ugly bug that happens when its reset repeatedly.
*so far unable to reproduce the crash when power button is pressed.

Things i notice:
- Start of app is faster
- Still a crash when i use Display On, or Display Off from the power menu
- Media test button does not work anymore
- Dont see any pictures / photos
- Buttons are the same size
- Screenshots work
- Zoom and Aspect work
- In general the app feel much faster


My mistake...

Here are the correct ones:

What does not look right?
to me it seems correct, i do the insert, and last_insert in 1 command, with the output in $PK_File var

it even works for me


I thought it would work that way, when i realised it didn't work as plan. thanks!!!

Here 2 new scripts,
 - add radiostations with select_last_id
 - delete radiostations


Had some sparetime, and name some progress on the script,

New features:
- Use variable for tempfile
- Check if the Url is already in the DB before adding
- Reuse genre if it exists
- Adds genre if it not exists
- Uses SELECT MAX(id) to find out last added row

@sambuca, i couldn't get a working SELECT LAST_INSERT_ID, i think if it because i used 2 seperate mysql -e statements, If MAX(id) is not suitable, i have to make LAST_INSERT_ID working somehow

Attached is the new version


I want to expand the script with checks to not add duplicates, and to check the genre and reuse that attribute, its still just a simple script.

As I have no experience using mysql, all advise is appreciated. I will try to make to as useable as possible.

@posde Thanks for the tips


Ok, here is a working script,

It will download an indexfile and process it into the LinuxMCE
It does not add Genre's, only the station's name and the url

Can somebody try this out? And yes, it could mess up your whole DB.....
If you only want to see what stations would be added, comment out the Add to Database lines before running the script


Another thing to consider is when to re-use an existing attribute.... You could keep adding attribute with the same name, but that would make duplicate attributes in LMCE, not sure you want that...

Sambuca, this would only affect the Genre... Personally, i dont use it, but i wanted to add it anyway.
I am not a database guy... i will try to make it as neat as possible, so your remark has been noted)))

Posde, Thanks, i will try that

I just saw it myself... Oops)
Fixed now

Made a little progress, i can fill pluto_main from the cmdline

Example to add Dutch Radio station 3FM to LMCE. run this in bash, and you should have an extra radio stream
Code: [Select]
Station="3FM 96.5"
Genre="Alternative Rock"

echo "insert into File (EK_MediaType,DateAdded,Filename,Missing,IsDirectory,IsNew) VALUES(43,NOW(),'$Url',0,0,1);" | mysql pluto_media
PK_File=$(echo "select * from File where Filename='$Url';" | mysql pluto_media | tail -n1 | awk -F" " '{print $1}')
echo "insert into Attribute (FK_AttributeType,Name) VALUES(10,'$Station');" | mysql pluto_media
FK_Attribute=$(echo "select * from Attribute where Name='$Station';" | mysql pluto_media | tail -n1 | awk -F" " '{print $1}')
echo "insert into File_Attribute (FK_File,FK_Attribute,Track,Section) VALUES('$PK_File','$FK_Attribute',0,0);" | mysql pluto_media
echo "insert into LongAttribute (FK_AttributeType,FK_File,Text) VALUES(8,'$PK_File','$Genre');" | mysql pluto_media

But somehow the Stations name does not get linked to the 'File'
Run the code from a commandline, and see for yourself.

What am i not seeing in the database?


Modified, to correct commands

Users / Automatic adding Internet Radio streams to LinuxMCE
« on: October 26, 2013, 12:18:36 am »
Hi all,

I found this nice site that had indexed a whole lot of internet radio stations.
Here you also can find 'Local' radio stations, based on your geolocation (IP based)

so i made a command that downloads the needed information, as this would seem to me like a handy function to have while installing LMCE, or available from the Webadmin

Code: [Select]
curl --silent | grep audio | grep station|  gawk -F'"' '{ print "Station : " $4}{system("curl --silent "$6" |  head -n1")}'
Code: [Select]
Station : #Station Name# (#Genre#)

Now i need some help with putting this info in LinuxMCE
Is there a commandline script i can call, to add media to the LMCE database?
Or should this be done via Mysql?


Users / Re: Need some dedicated testers.
« on: October 25, 2013, 10:39:21 pm »
I have the same as WhateverFits, Audio plays, but qorbiter crashes. At home, over wifi

For me the screen rotation is working perfectly, almost instant, just like other apps. This is running on my Nexus4
On my Desire HD, it's a little slow. But also about the same as other apps.

Just the redraw is not a pretty sight...

Langston, thank you for you patience with us lousy and lazy testers (yes i speak only for myself) ;)


Users / Re: Need some dedicated testers.
« on: October 25, 2013, 04:59:24 pm »
Langston, did you also change something with the screen rotation? (landscape/portrait)
This seems to go much better for me.


Pages: 1 2 3 [4] 5 6 7