[RELEASE] Library Editor script
#46
(2015-07-26, 06:49)Dave the Minion Wrote: OK got the sort title to come up (without errors) in the options list. But it doesn't seem to access the actual sorttitle from the metadata. So getting there but not quite arrived yet.

Thanks for all the help to this point though!

Yea, the sorttitle edit comes up blank but what you enter will get added to the database at c10.
The only thing I can think of to retrieve the sorttitle from the db is a json request. As I stated earlier there is no infolabel that I could find.

PHP Code:
elif actionstring == "sorttitle" :
    
self._edit_db_string("",self.TYPE,"sorttitle"

replacing the "" (empty string) with the json request for the sorttitle like so...

PHP Code:
elif actionstring == "sorttitle" :
    
self._edit_db_string(xbmc.executeJSONRPC(.............),self.TYPE,"sorttitle"

Good luck, when I get some free time later in the week I will have a closer look, that's if you haven't already got it sorted. Wink
Reply
#47
I'll be frank and admit I have no idea what a json request is. Was hoping this was something semi-simple to achieve. Interesting how some things just work so simple yet something you'd think would be simple can make you want to blow your brains out. I'll keep poking to see if I can figure something out.
Reply
#48
I had a closer look and got it working. Turned out to be fairly simple.
You could go crazy and turn the added code in a module to service other requests but seeing as I use the builtin kodi edit I think I'll leave it here and let you tinker if you like. Wink

Here is the code I added to get it working.
PHP Code:
elif actionstring == "sorttitle" :
    
json_request xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "title", "operator": "is", "value": "'+xbmc.getInfoLabel('ListItem.Title')+'"}, "properties" : ["sorttitle"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}'
    
json_request unicode(json_request'utf-8'errors='ignore')
    
json_response json.loads(json_request)
    if 
json_response.has_key('result') and (json_response['result'] != None) and json_response['result'].has_key('movies'):
        for 
item in json_response['result']['movies']:
            
sort_title item['sorttitle']
    if 
sort_title == "":
        
self._edit_db_string(xbmc.getInfoLabel('ListItem.Title'),self.TYPE,"sorttitle")
    else:
        
self._edit_db_string(sort_title,self.TYPE,"sorttitle"

Here is the default.py file
default.zip
Reply
#49
Fantastic! Thanks for the effort to sort this out!
Reply
#50
No probs, it was a quick fix and I have had a bit more time to look at it. As the script provides the movieid, I think it would be better to use 'VideoLibrary.GetMovieDetails'.
The way it is now it would get confused if two movies were named the same, so I made some adjustments. Smile

code..
PHP Code:
elif actionstring == "sorttitle" :
            
json_request xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "VideoLibrary.GetMovieDetails", "params": {"properties": ["sorttitle"], "movieid": %s }}' self.DBID)
            
json_request unicode(json_request'utf-8'errors='ignore')
            
json_response json.loads(json_request)
            if 
json_response.has_key('result') and (json_response['result'] != None) and json_response['result'].has_key('moviedetails'):
                
sort_title str(json_response['result']['moviedetails']['sorttitle'])
            if 
sort_title == "":
                
self._edit_db_string(xbmc.getInfoLabel('ListItem.Title'),self.TYPE,"sorttitle")
            else:
                
self._edit_db_string(sort_title,self.TYPE,"sorttitle"

here is the adjusted default.py
default_update.zip
Reply
#51
Hi folks, I see there has been little activity on this thread for some time. Hopefully there is still some interest in this script and people willing to help a newbe out...

I've asked for consideration of integrating support for this script into the context menu in the support thread for the skin I use (Xonfluence).

But in the meantime I have successfully installed the addon to my KODI Krypton system and mapped it to a remote key. However I get a script error pop up when I push the button. Is there anyone here who could assist me in troubleshooting this? I'm not a coder, so I can only follow instructions...

If so, what information would you like me to provide... Debug logs, KODI build etc I assume...

Also, I'm using a shared SQL database, not the standard SQLite, so perhaps that is not supported by the script?

Cheers,
Robert
Reply
#52
Working on migrating my custom skin to Keia and this add-on doesn't seem to show up in my add-ons list now. I use this feature quite regularly to edit all sorts of info directly within Kodi and it is fantastic. Anyone still using it and been able to get it working with Leia?

Cheers!
Reply
#53
(2019-04-20, 09:06)K0D1User1138 Wrote: Working on migrating my custom skin to Keia and this add-on doesn't seem to show up in my add-ons list now. I use this feature quite regularly to edit all sorts of info directly within Kodi and it is fantastic. Anyone still using it and been able to get it working with Leia?

Cheers!
Check the first post for the updated version:
https://r.tapatalk.com/shareLink?url=htt...are_type=t
Reply
#54
(2019-04-20, 18:13)MB1968 Wrote:
(2019-04-20, 09:06)K0D1User1138 Wrote: Working on migrating my custom skin to Keia and this add-on doesn't seem to show up in my add-ons list now. I use this feature quite regularly to edit all sorts of info directly within Kodi and it is fantastic. Anyone still using it and been able to get it working with Leia?

Cheers!
Check the first post for the updated version:
https://r.tapatalk.com/shareLink?url=htt...are_type=t 

Thank you very much!

Cheers!
Reply
#55
Thanks for pointing to the updated Library Editor for Leia!

 In the previous version of LE I was able to have SortTitle added to the options for movies and TV shows. I thought I had figured out how to add those to this version but so far it does not work. I have Sorttitle added to the default.py file, the same as I had it in the previous version. It shows up in the list of editable options but when selected it just flashes back to the list of options. Not sure why.

The added string is

           self._AddToList( xbmc.getLocalizedString(171),"sorttitle" )

Anyone with an ideas how to get this string to function?
Reply



Logout Mark Read Team Forum Stats Members Help
[RELEASE] Library Editor script3
This forum uses Lukasz Tkacz MyBB addons.