Scanning Media Info

If you need any help with XBMC4XBOX, such as installing or using the software, please post it in here.
Post Reply
User avatar
NeMesiS
Posts: 188
Joined: Sun May 10, 2015 3:56 am
Location: Melbourne
Has thanked: 1 time
Been thanked: 12 times

Scanning Media Info

Post by NeMesiS »

So I use XBMC as my main dashboard, I also have a large collection of games
Every time I go to my Games a popup with the title "Scanning Media Info" would show
It would the continue to scan all 432 xbox games I have...

Is there anyway to be able to prevent this?
User avatar
Rocky5
Posts: 961
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 91 times
Been thanked: 249 times

Re: Scanning Media Info

Post by Rocky5 »

NeMesiS wrote:So I use XBMC as my main dashboard, I also have a large collection of games
Every time I go to my Games a popup with the title "Scanning Media Info" would show
It would the continue to scan all 432 xbox games I have...

Is there anyway to be able to prevent this?
This should only happen the first time, after they have been scanned into the MyPrograms6.db they will scan within a few seconds as XBMC scans for new games.

If for some reason yours is taking ages every time, try removing your MyPrograms6.db from Q:\USERDATA\Database\ folder.
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5
User avatar
NeMesiS
Posts: 188
Joined: Sun May 10, 2015 3:56 am
Location: Melbourne
Has thanked: 1 time
Been thanked: 12 times

Re: Scanning Media Info

Post by NeMesiS »

Rocky5 wrote:This should only happen the first time, after they have been scanned into the MyPrograms6.db they will scan within a few seconds as XBMC scans for new games.
Yea on the first time it took a few minutes to scan through the 400+ games, every time I return to the games menu it scans again but this time much quicker (only a few seconds).
I guess its looking for new games even if there isnt any, is this a normal feature for XBMC? I just find it annoying and strange that it doesn't do the same thing when it comes to apps or emulators.
tim619
Posts: 204
Joined: Sun Mar 10, 2013 10:22 am
Has thanked: 25 times
Been thanked: 59 times

Re: Scanning Media Info

Post by tim619 »

I was also wondering before why this takes so long and for example displaying a large amount of movies is quick, but has similiar information to display. Maybe this belongs to trainer information but I have a feeling that we could improve this behaviour.

A possible fix would be to not scan for new games at all but make it an optional button --> 'scan for new games'. This way the games should list quickly and nowadays it's likely that x4x users have a constant game list.
User avatar
Rocky5
Posts: 961
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 91 times
Been thanked: 249 times

Re: Scanning Media Info

Post by Rocky5 »

NeMesiS wrote:
Rocky5 wrote:This should only happen the first time, after they have been scanned into the MyPrograms6.db they will scan within a few seconds as XBMC scans for new games.
Yea on the first time it took a few minutes to scan through the 400+ games, every time I return to the games menu it scans again but this time much quicker (only a few seconds).
I guess its looking for new games even if there isnt any, is this a normal feature for XBMC? I just find it annoying and strange that it doesn't do the same thing when it comes to apps or emulators.
Yup normal, it does it with everything inside the programs menu. So emulators, applications eg... just we don't have hundreds of those so it takes a second or less to scan for new ones.
(In my XBMC4Kids, I Labeled the scanning "Scanning for new games" as that's basically what it's doing)
tim619 wrote:I was also wondering before why this takes so long and for example displaying a large amount of movies is quick, but has similiar information to display. Maybe this belongs to trainer information but I have a feeling that we could improve this behaviour.

A possible fix would be to not scan for new games at all but make it an optional button --> 'scan for new games'. This way the games should list quickly and nowadays it's likely that x4x users have a constant game list.
I may have a look and see if I can do it. Though I'm no C++ programmer :D trial and error is my game :lol:
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5
User avatar
Dom DXecutioner
Posts: 585
Joined: Thu Jul 05, 2012 11:59 pm
Location: California
Has thanked: 249 times
Been thanked: 216 times
Contact:

Scanning Media Info

Post by Dom DXecutioner »

If I'm not mistaken, this is the intended behavior for programs, files, video files, and music files. And it makes perfect sense.

Because they are not a static library, xbmc scans for new files added to the focused folder to ensure all of your files are captured. And yes, although they are added to a database, they are not used the same as in the movies, tv library.

In fact, even when games and files are deleted, they are never removed from the database, but they are not shown since the scan is done in real time. As with anything else, the more items you have, the longer the scan will take. This is specially true when using .CUT files.

In movies/tv library, you'll noticed that if you remove any movie, tv show file, it will still show in your library until you explicitly do a library clean up, even if the file no longer exists. However, that's not the case with programs and video/music files. That behavior is intentional, and with good reason.

Even if you find a way to remove this behavior, I doubt that it would be implemented in our main branch. Still, good luck.
Image
User avatar
Rocky5
Posts: 961
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 91 times
Been thanked: 249 times

Re: Scanning Media Info

Post by Rocky5 »

Dom DXecutioner wrote:I doubt that it would be implemented in our main branch. Still, good luck.
What about fullscreen splash? or keeping TitleMeta.xbx in folders (like the rest) in the savegame manager?
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5
User avatar
Dom DXecutioner
Posts: 585
Joined: Thu Jul 05, 2012 11:59 pm
Location: California
Has thanked: 249 times
Been thanked: 216 times
Contact:

Scanning Media Info

Post by Dom DXecutioner »

Regarding the programs scanning, please don't get discouraged by my statement to find a solution that works best possibly not making it to trunk. It's just an opinion. Who knows, if you find a viable solution and submit a patch, BuZz may very well commit it to trunk.

A while back I remember someone having a discussion about the splash screen but the devs were not keen to the idea of a full screen splash at the time. Although, come to think of it, I believe it was more about playing a video as a splash. Either way, I don't see an issue with your enhancements, but I can't speak for BuZz.

What I can say is that if you're interested in that functionality, you will have to submit a patch and diff for BuZz to review and possibly implement. Otherwise, he won't know or care about it.
Image
User avatar
NeMesiS
Posts: 188
Joined: Sun May 10, 2015 3:56 am
Location: Melbourne
Has thanked: 1 time
Been thanked: 12 times

Re: Scanning Media Info

Post by NeMesiS »

Just a thought, Instead of trying to remove or disable this feature would it be possible to hide the popup somehow?
User avatar
Rocky5
Posts: 961
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 91 times
Been thanked: 249 times

Re: Scanning Media Info

Post by Rocky5 »

NeMesiS wrote:Just a thought, Instead of trying to remove or disable this feature would it be possible to hide the popup somehow?
The dialogprogress yeah, but you will have to wait till the scan is done before your games show. So it's pointless, you cannot get round the wait.
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5
tim619
Posts: 204
Joined: Sun Mar 10, 2013 10:22 am
Has thanked: 25 times
Been thanked: 59 times

Re: Scanning Media Info

Post by tim619 »

In my opinion there is absolutely no reason why we should stay with the current algorithm.
So if someone finds the place in the code we could discuss a proper algorithm.
Maybe a feature request at redmine tracker would be good too, just for remembering in case it get's lost.
User avatar
Dom DXecutioner
Posts: 585
Joined: Thu Jul 05, 2012 11:59 pm
Location: California
Has thanked: 249 times
Been thanked: 216 times
Contact:

Scanning Media Info

Post by Dom DXecutioner »

@Tim69: I disagree, that aspect of the programs should not change. Ideally one should build a library window instead. As for feature request, I doubt BuZz would be interested in changing something trivial without a patch and diff file.

This is purely speculative, of course. Perhaps if you build it, he will come...

:)
Image
User avatar
Rocky5
Posts: 961
Joined: Sat Feb 08, 2014 5:27 am
Has thanked: 91 times
Been thanked: 249 times

Re: Scanning Media Info

Post by Rocky5 »

Here is a script I made so that you can scan all your games into the favourites.xml that way you can load that instead of games to get almost instant access to your games.
(Original idea by headphone)


How it works, you add this to a button you can define the location as its setup to be used with my XBMC4Kids.
# Use Games + default.tbn = RunScript( Special://xbmc/scripts/XBMC4Kids/Utilities/Generate Favourites.py,1,1 )
# Use Games + cached tbn = RunScript( Special://xbmc/scripts/XBMC4Kids/Utilities/Generate Favourites.py,1,0 )
# Disabled uses MyPrograms6.db = RunScript( Special://xbmc/scripts/XBMC4Kids/Utilities/Generate Favourites.py,0,0 )
# Disabled uses MyPrograms6.db = RunScript( Special://xbmc/scripts/XBMC4Kids/Utilities/Generate Favourites.py )

Code: Select all

########################################################################################################################################
'''
	Script by Rocky5 (original idea headphone)
	Used to create a favourites.xml from all your games.
'''
########################################################################################################################################


import xbmc
import xbmcgui
import time
import os
import sqlite3
import re
import glob
import struct
import operator
import string


########################################################################################################################################
# Start markings for the log file.
########################################################################################################################################
print "================================================================================"
print "| Scripts\XBMC4Kids\Utilities\Generate Favourites.py loaded."
print "| ------------------------------------------------------------------------------"


# Enabled if you want the games directory (ie, E:\Games\, F:\Games\, or G:\Games\) to be used to build the xml.
# You can also enabled the TBN option, this will use the default.tbn files, instead of the cached versions XBMC has made. 
# Use Games + default.tbn	= RunScript( Special://xbmc/scripts/XBMC4Kids/Utilities/Generate Favourites.py,1,1 )
# Use Games + cached tbn	= RunScript( Special://xbmc/scripts/XBMC4Kids/Utilities/Generate Favourites.py,1,0 )
# Disabled					= RunScript( Special://xbmc/scripts/XBMC4Kids/Utilities/Generate Favourites.py,0,0 )
# Disabled					= RunScript( Special://xbmc/scripts/XBMC4Kids/Utilities/Generate Favourites.py )
try:
	Use_Game_Directory = sys.argv[1][0]
except:
	Use_Game_Directory = "0"
try:
	Use_Game_Directory_TBN = sys.argv[2][0]
except:
	Use_Game_Directory_TBN = "0"


def XbeInfo(FileName): # Modified by me. Original by chunk_1970 - http://forum.kodi.tv/showthread.php?tid=24666&pid=125356#pid125356
    try :
        XbeDta          =   {}
        if os.path.isfile(FileName) and FileName.endswith('.xbe')   :
            xbe         =   open(FileName,'rb')
            ## Get XbeId Data ##
            xbe.seek(0x104)
            tLoadAddr   =   xbe.read(4)
            xbe.seek(0x118)
            tCertLoc    =   xbe.read(4)
            LoadAddr    =   struct.unpack('L',tLoadAddr)
            CertLoc     =   struct.unpack('L',tCertLoc)
            CertBase    =   CertLoc[0] - LoadAddr[0]
            CertBase    +=  8
            IdStart     =   xbe.seek(CertBase)
            tIdData     =   xbe.read(4)
            IdData      =   struct.unpack('L',tIdData)
            ## Get Xbe Title ##
            XbeTitle    =   ''
            for dta in struct.unpack(operator.repeat('H',40),xbe.read(0x0050)):
                try     :
                    if dta != 00:	XbeTitle += str(unichr(dta))
                except  :   pass
            XbeDta    =   str(XbeTitle)
            #XbeDta['Title']     =   str(XbeTitle)
            #XbeDta['Id']        =   str(hex(IdData[0])[2:-1]).lower().rjust(8,'0')
            #XbeDta['Path']      =   str(FileName)
            xbe.close()
        return XbeDta
    except  :
        xbe.close()
        return {}

		
Current_Profile_Directory = xbmc.translatePath( 'special://profile/' )
Game_Directories = [ "E:\\Games\\", "F:\\Games\\", "G:\\Games\\" ]
Favourites_XML = xbmc.translatePath( "special://Profile/favourites.xml")
pDialog = xbmcgui.DialogProgress()
dialog = xbmcgui.Dialog()
progress = 0
pDialog.update( 0 )


if os.path.isfile(Favourites_XML) == 1: os.remove(Favourites_XML)
f=open(Favourites_XML,"w")
f.write("<favourites>\n")


if Use_Game_Directory == "1":
	pDialog.create('Building Favourites.xml','','Using the Games directory to build the favourites.xml')
	time.sleep(2)
	print "| Games Directory Used."
	for Game_Directories in Game_Directories :
		for Items in sorted( os.listdir( Game_Directories ) ):
			if os.path.isdir(os.path.join( Game_Directories, Items)):
				Game_Directory = os.path.join( Game_Directories, Items )
				progress += 1
				if progress == 1:	pDialog.update( 0,"Scanning Games","Processing." )
				if os.path.isdir( Game_Directory ) :
					XBEFiles = glob.glob( os.path.join( Game_Directory, "default.xbe" ) )
					TBNFiles = glob.glob( os.path.join( Game_Directory, "default.tbn" ) )
					for TBN in TBNFiles:
						for Path in XBEFiles:
							XBETitle = XbeInfo( Path )
							ThumbCache = xbmc.getCacheThumbName( Path )
							Path = Path.replace("\\","\\\\")
							pDialog.update( int ( progress / float( len ( sorted( os.listdir( Game_Directories ) ) ) ) *100 ),"Scanning Games",Items )
							if Use_Game_Directory_TBN == "1":
								line='<favourite name="' + XBETitle.encode(encoding='UTF-8') + '\" thumb=\"' + TBN + '">RunXBE("' + Path.encode(encoding='UTF-8') + '")</favourite>\n'
								f.write(line)
							else:
								line='<favourite name="' + XBETitle.encode(encoding='UTF-8') + '\" thumb=\"' + Current_Profile_Directory + "Thumbnails\\Programs\\" + ThumbCache[0] + "\\" + ThumbCache + '">RunXBE("' + Path.encode(encoding='UTF-8') + '")</favourite>\n'
								f.write(line)
	f.write("</favourites>")
	f.close()
else:
	pDialog.create('Building Favourites.xml','','Using MyPrograms6.db to build the favourites.xml')
	time.sleep(2)
	print "| XBMC MyPrograms6.db Used."
	cursor = sqlite3.connect(xbmc.translatePath( "special://Profile/Database/MyPrograms6.db" )).cursor()
	sql = "SELECT * FROM files"
	cursor.execute(sql)
	rows = cursor.fetchall()
	for row in rows:
		progress += 1
		if progress == 1:	pDialog.update( 0,"Scanning Games","Processing." )
		title = row[3]
		xbe_path = row[1].replace('\\','\\\\')
		ThumbCache = xbmc.getCacheThumbName( row[1] )
		pDialog.update( int ( progress / float( len ( os.listdir( row[1][:9] ) ) ) *100 ),"Scanning Games",title )
		line='<favourite name="' + title.encode(encoding='UTF-8') + '\" thumb=\"' + Current_Profile_Directory + "Thumbnails\\Programs\\" + ThumbCache[0] + "\\" + ThumbCache + '">RunXBE("' + xbe_path.encode(encoding='UTF-8') + '")</favourite>\n'
		f.write(line)
	f.write("</favourites>")
	f.close()

pDialog.update(100, 'Please wait')
pDialog.close()
dialog.ok('Building Favourites.xml','','Done.')
print "================================================================================"
Download Xbox Softmodding Tool & Extras Disc
XBMC4Kids Mod


Xbox Gamertag = Connxtion
PSN ID = JCRocky5
Post Reply