View stored bookmarks on screen
#1
Sorry if this was asked before (could not find a related thread)...
I'd like to be able to view a list of unfinished videos, this works now if I first get to the Video file and go to OSD and browse the bookmarks. Ideally I should just be able to access all of the bookmarks in one place without having to first go to the media.
While browsing through the SQL database I found that all of the necessary information is already available, just that there is no way to get to it from the Menus. I did run into this thread, seems like the exact thing I was looking for except it was not written for the default Confluence skin that I'm using.
I'm fairly adept at scripting and stuff except I don't know where to start to tie in the data stored in the database to a menu. If someone has already done that please reply with a pointer. Any pointers as to how I can go about getting this scripted myself would be appreciated too.
Thanks.
Reply
#2
I was able to get this working, thought it might help someone else so here's the Home.xml and the backend python script that add a Resume section to the Home screeen.
I tested this with the default Confluence skin, basically you would add the snippet I have below to the end of the skin's Home.xml file (before the last </controls> </window>). The backend python script is for gathering the bookmarks info and making it available for the visual. I created an autoexec.py file with this script and dropped in userdata folder. This is hacky, feel free to do it in a cleaner way if you care. This works well on XBMC startup to refresh the bookmarks but after launched the only time it refreshes is when you click on any of the Resume points that show up on the Home screen. Feel free to add a separate button to refresh the bookmarks if you'd prefer that.
I borrowed heavily from the post that was linked to in my prior post, so thanks to pilluli.

Home.xml snippet:
Code:
    <!-- Resume-->
        <control type="group">
            <posx>20</posx>
            <posy>20</posy>
            <visible>true</visible>
            <control type="group">
                <control type="image">
                    <description>background top</description>
                    <posx>0</posx>
                    <posy>0</posy>
                    <width>512</width>
                    <height>50</height>
                    <colordiffuse>CCFFFFFF</colordiffuse>
                    <texture>DialogContextTop.png</texture>
                </control>
                <control type="image">
                    <posx>0</posx>
                    <posy>50</posy>
                    <description>background</description>
                    <width>512</width>
                    <height>150</height>
                    <colordiffuse>CCFFFFFF</colordiffuse>
                    <texture>DialogContextMiddle.png</texture>
                </control>
                <control type="image">
                    <description>background bottom</description>
                    <posx>0</posx>
                    <posy>200</posy>
                    <width>512</width>
                    <height>50</height>
                    <colordiffuse>CCFFFFFF</colordiffuse>
                    <texture>DialogContextBottom.png</texture>
                </control>
            
            <control type="label">
                <description>Title</description>
                <posx>50</posx>
                <posy>40</posy>
                <width>150</width>
                <height>30</height>
                <textcolor>lightgrey</textcolor>
                <shadowcolor>black</shadowcolor>
                <font>font20_title</font>
                <label>Resume</label>
                <aligny>center</aligny>
                <align>left</align>
            </control>

            <control type="group">
                <description>Resume Menu</description>
                <posx>40</posx>
                <posy>25</posy>
                <control type="button" id="32">
                    <description>Resume playback button</description>
                    <posx>10</posx>
                    <posy>50</posy>
                    <width>420</width>
                    <height>25</height>
                    <label>$INFO[Window(Home).Property(MyVal.1.Name)]</label>
                    <onclick>XBMC.RunScript(special://profile\autoexec.py)</onclick>
                        <onclick>PlayMedia($INFO[Window(Home).Property(MyVal.1.Path)])</onclick>
                    <aligny>center</aligny>
                    <textcolor>88FF7777</textcolor>
                    <focusedcolor>white</focusedcolor>
                    <onup>20</onup>
                    <ondown>33</ondown>
                </control>
                <control type="button" id="33">
                    <description>Resume playback button</description>
                    <posx>10</posx>
                    <posy>75</posy>
                    <width>420</width>
                    <height>25</height>
                    <label>$INFO[Window(Home).Property(MyVal.2.Name)]</label>
                    <onclick>XBMC.RunScript(special://profile\autoexec.py)</onclick>
                    <onclick>PlayMedia($INFO[Window(Home).Property(MyVal.2.Path)])</onclick>
                    <aligny>center</aligny>
                    <textcolor>88FF7777</textcolor>
                    <focusedcolor>white</focusedcolor>
                    <onup>32</onup>
                    <ondown>34</ondown>
                </control>
                <control type="button" id="34">
                    <description>Resume playback button</description>
                    <posx>10</posx>
                    <posy>100</posy>
                    <width>420</width>
                    <height>25</height>
                    <label>$INFO[Window(Home).Property(MyVal.3.Name)]</label>
                    <onclick>XBMC.RunScript(special://profile\autoexec.py)</onclick>
                    <onclick>PlayMedia($INFO[Window(Home).Property(MyVal.3.Path)])</onclick>
                    <aligny>center</aligny>
                    <textcolor>88FF7777</textcolor>
                    <focusedcolor>white</focusedcolor>
                    <onup>33</onup>
                    <ondown>35</ondown>
                </control>
                <control type="button" id="35">
                    <description>Resume playback button</description>
                    <posx>10</posx>
                    <posy>125</posy>
                    <width>420</width>
                    <height>25</height>
                    <label>$INFO[Window(Home).Property(MyVal.4.Name)]</label>
                    <onclick>XBMC.RunScript(special://profile\autoexec.py)</onclick>
                    <onclick>PlayMedia($INFO[Window(Home).Property(MyVal.4.Path)])</onclick>
                    <aligny>center</aligny>
                    <textcolor>88FF7777</textcolor>
                    <focusedcolor>white</focusedcolor>
                    <onup>34</onup>
                    <ondown>36</ondown>
                </control>
                <control type="button" id="36">
                    <description>Resume playback button</description>
                    <posx>10</posx>
                    <posy>150</posy>
                    <width>420</width>
                    <height>25</height>
                    <label>$INFO[Window(Home).Property(MyVal.5.Name)]</label>
                    <onclick>XBMC.RunScript(special://profile\autoexec.py)</onclick>
                    <onclick>PlayMedia($INFO[Window(Home).Property(MyVal.5.Path)])</onclick>
                    <aligny>center</aligny>
                    <textcolor>88FF7777</textcolor>
                    <focusedcolor>white</focusedcolor>
                    <onup>35</onup>
                    <ondown>9003</ondown>
                </control>                
            </control>    
        </control>
        <!--Resume-->

Backend script:
Code:
import urllib
import os
import sys
from traceback import print_exc
import re
import socket
import xbmc
import xbmcgui
import xbmcplugin
import time
import threading
from urllib import quote_plus, unquote_plus

print "[Resume] started..."
HomeWindow = xbmcgui.Window( 10000 )
xbmc.executehttpapi( "SetResponseFormat()" )
xbmc.executehttpapi( "SetResponseFormat(OpenField,%s)" % ( "<field>", ) )
xbmc.executehttpapi( "SetResponseFormat(CloseField,%s)" % ( "</field>", ) )
xbmc.executehttpapi( "SetResponseFormat(OpenRecord,%s)" % ( "<record>", ) )
xbmc.executehttpapi( "SetResponseFormat(CloseRecord,%s)" % ( "</record>", ) )

sql_movies = "select bookmark.idBookmark,files.strfilename,path.strPath from bookmark join files on (files.idFile = bookmark.idFile) join  path on (path.idPath =files.idPath) ORDER BY  bookmark.idFile DESC limit 5"
movies_xml = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( sql_movies ), )
movies = re.findall( "<record>(.+?)</record>", movies_xml, re.DOTALL )

count = 0
for movie in movies:
    fields = re.findall( "<field>(.*?)</field>", movie, re.DOTALL )
    videoFile = fields[1]
    videoPath = fields[2]
    count = count + 1
    fullPath =  videoPath+videoFile
    HomeWindow.setProperty( "MyVal.%d.Name" % ( count ), videoFile )
    HomeWindow.setProperty( "MyVal.%d.Path" % ( count ), fullPath )
Reply
#3
Wow... I can't believe nobody thinks this is an awesome feature to have. I tried this and it didn't work. I tried the video.bookmark.browser addon with the modified aeon nox skin and that didn't work.

I wish I knew how to make this work!

Quite often we have to leave a movie in the middle of watching it. I guess nobody else does.Confused
Reply
#4
(2014-04-24, 00:19)qualsdad Wrote: Wow... I can't believe nobody thinks this is an awesome feature to have. I tried this and it didn't work. I tried the video.bookmark.browser addon with the modified aeon nox skin and that didn't work.

I wish I knew how to make this work!

Quite often we have to leave a movie in the middle of watching it. I guess nobody else does.Confused

Yes, this is extremely useful and has saved me and my family a lot of time searching through folders and stuff. Anyway, the code I posted worked with the XBMC version from 2 years ago. I have been updating my XBMC devices to keep it working and I'll post an update with the new code that works with Gotham shortly.
Reply
#5
Ok here you go...
First download this zip file: http://www.filedropper.com/confluencemod unzip it in the addons folder. This will give you a new skin called confluencd and you need to select this skin from settings.
Copy the text from below and put it in a file called autoexec1.py in the userdata folder.
Look for the line with "cnx = mysql.connector.connect(host='192.168.10.10', user='xbmc', password='xbmc', database='xbmc_video75')" and change it appropriately for your setup (hopefully you can figure this out for yourself).
Let me know if you run into problems.
[/code]
Code:
import urllib
import os
import sys
from traceback import print_exc
import re
import socket
import xbmc
import xbmcgui
import xbmcplugin
import time
import threading

import mysql.connector

from urllib import quote_plus, unquote_plus

print "[Resume] started..."
HomeWindow = xbmcgui.Window( 10000 )

import datetime
import mysql.connector

cnx = mysql.connector.connect(host='192.168.10.10', user='xbmc', password='xbmc', database='xbmc_video75')
cursor = cnx.cursor()

query = ("SELECT bookmark.idBookmark,files.strfilename,path.strPath FROM bookmark JOIN files ON (files.idFile = bookmark.idFile) JOIN  path ON (path.idPath =files.idPath) ORDER BY  bookmark.idFile DESC limit 5")

cursor.execute(query)
count = 0
for (idFile, strfilename, strPath) in cursor:

  fullPath = strPath + strfilename
  videoFile = strfilename
  plugin = re.search('plugin://plugin.video.(.+?)/', videoFile);
  if plugin :
    pname = plugin.group(1)
    videoFile = pname + ':'
    name = re.search('name=(.+?)[&$]', strfilename)
    if name :
      videoFile = videoFile  + urllib.unquote_plus(name.group(1))
  count = count + 1
  cPath = fullPath + "." + str(count)
  HomeWindow.setProperty( "MyVal.%d.Name" % ( count ), videoFile )
  HomeWindow.setProperty( "MyVal.%d.Path" % ( count ), fullPath )

cursor.close()
cnx.close()
Reply
#6
Hello xbmconatv2. what stroke of luck. I am really interested in this feature and surprised its not in XBMC already but the file you linked to won't open it just goes on homepage of filedropper. I thought I need to register but its not free. can you upload again to somewhere else so I can download it.

Thankyou so much for creating this. Looks Ideal for my needs. Also how to you launch it? I'm interested in keymapping this. so what action do I put in the Keymap. Thankyou Smile
Reply
#7
I would really like to try this mod. does anybody have an account with filedropper be willing to download the file and upload to free site? Would be very grateful.
Reply
#8
Bump. No one got the zip file?
Reply
#9
Bump.. sorry but this feature sounds like it'll be used alot. I'm sure theres more interested in this feature and xbmconatv2 hasn't logged in yet. does anyone have a filedropper account that can download and put on a free downloding site?
Reply
#10
Let me see if I can be of any help!

1) I hope you can manage to integrate Home.xml content provided by @xbmconatv2 into whatever skin you are using.

2) Place the following content in userdata/autoexec.py
Code:
import urllib
import os
import sys
from traceback import print_exc
import re
import socket
import xbmc
import xbmcgui
import xbmcplugin
import time
import threading

try:
    from sqlite3 import dbapi2 as sqlite
    print "Loading sqlite3 as DB engine"
except:
    from pysqlite2 import dbapi2 as sqlite
    print "Loading pysqlite2 as DB engine"

print "[Resume] started..."
HomeWindow = xbmcgui.Window( 10000 )

import datetime

### Please replace the .db name with the filename that you find in userdata/Database

DB = os.path.join(xbmc.translatePath("special://database"), 'MyVideos78.db')
db = sqlite.connect(DB)

query = "SELECT bookmark.idBookmark,files.strfilename,path.strPath FROM bookmark JOIN files ON (files.idFile = bookmark.idFile) JOIN  path ON (path.idPath =files.idPath) ORDER BY  bookmark.idFile DESC limit 5"

count = 0

for fields in db.execute(query):
  idFile = fields[0]
  strfilename = fields[1]
  strPath = fields[2]

  fullPath = strPath + strfilename
  videoFile = strfilename
  count = count + 1
  HomeWindow.setProperty( "MyVal.%d.Name" % ( count ), videoFile )
  HomeWindow.setProperty( "MyVal.%d.Path" % ( count ), fullPath )

db.close()

I've not tested the above code. But, I've leveraged the above work in a bit different script/way and is working fine with XBMC Gotham.
Reply
#11
sorry I dont understand the instructions. The original poster of the mod wanted us to download a new skin. I can't get the skin because I dont have an account.

I dont know anything about programming so if you could provide step by step instructions I would be most grateful. I'm on Gotham using default confluence. Thanks for your time in helping me out
Reply
#12
I don't want to mess my HTPC running Ubuntu+Gotham for this. And my Windows XP Wink can't run Gotham! Let me see if I can do something in coming days/weeks!

Let me understand your requirement. You want to see list of unfinished video, at max 5 of those, on Home screen and then want the ability to play them. Is that so?
Reply
#13
Hey xbmc-user, I don't blame you for messing around upgrading, its a huge task. I'll keep an eye out in the future if you do manage to get something, but for now its okay.

xbmconatv2 basically managed to show up all your bookmarked movies in home screen I believe (his own modified skin) I don't think it was limited to 5. If only someone has an account with filedropper, but I heard that if no one uses the file after 30 days it gets deleted anyway, so no point trying to access that file.

Thanks for trying though, but I'll do without unless you manage to get something. Smile
Reply
#14
Isn't this simply a smart playlist with "In Progress" = True ?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#15
you got me excited nickr, so I tried it but it doesn't work. I went into an addon loaded a movie and created a bookmark. made the playlist (well made it before) and nothing is coming up in the playlist. is the playlist function for movies in Library?

TL'DR doesn't work
Reply

Logout Mark Read Team Forum Stats Members Help
View stored bookmarks on screen0