MP TV Series completely rebuilds database if my server crashes. (2 Viewers)

flixxx

Portal Pro
December 7, 2007
68
0
Hello,

I just recently installed the new version of MP TV series with Mediaportal 1.1.0 final and i'm having a big problem with my database.

Let me first explain what would happen in the past;

Prior to the upgrade when I would reboot my server or have a server crash, after the server rebooted MPTVseries had all of the shows "double". I would go into --> Actions --> Force local scan and the issue would resolve itself no problem.

Now on the other hand something horrible happens.... It seems to completely rebuild the database, so all the "watched" statuses get disabled, it asks me to confirm shows and it even messes up some shows. For example "The office" it grabs info from the british version season 1-3 but the rest is the original.

This was just introduced with the new MPTV series, twice I had to get a backup of my database but i'm wondering why the sudden change of behaviour?
 

RoChess

Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    If it was me, I would worry more on the 'why' my system crashes instead of trying to fight the symptoms.

    Use a script otherwise to backup your database with a datestamp before you launch MediaPortal, that way you can always go back to any point in time you wish when corruption occurs.

    The following script is what I use myself:

    [collapse]
    Code:
    @Echo Off
    REM Script to backup important files with date/time stamp, before launching MediaPortal.
    REM It also makes sure MediaPortal is not already running.
    REM Last Modified: March 1st 2010
    REM Author: RoChess
    
    cls
    echo.
    
    SET LogFolder="%ProgramData%\Team MediaPortal\MediaPortal\log\"
    SET DatabaseFolder="%ProgramData%\Team MediaPortal\MediaPortal\database\"
    
    SET BackupFolder=%UserProfile%\Desktop\MediaPortal Backups
    SET Zip="C:\Program Files\7-Zip\7z.exe"
    SET Delay=ping 1.1 -n 1 -w 5000
    
    
    REM --- Check if MediaPortal is still running
    tasklist | find /i /c "MediaPortal.exe" &&goto MediaPortalIsRunning
    tasklist | find /i /c "PluginConfigLoader.exe" &&goto MediaPortalIsRunning
    
    
    IF NOT EXIST %Zip% (
    	echo   WARNING: 7-Zip program is required to compress the backup files.
    	echo.
    	echo     Please install it into: %Zip%
    	goto ExitDelay
    )
    
    
    IF NOT EXIST %LogFolder% (
    	echo   WARNING: MediaPortal.log file can not be found.
    	echo.
    	echo     Please edit this batch file to correct the "LogFolder".
    	goto ExitDelay
    ) ELSE (
    	cd %LogFolder%
    	IF EXIST MediaPortal.log (
    		REM --- Use log file for stamp info
    		FOR /F "eol=[ tokens=1,2" %%x IN (MediaPortal.log) DO (
    			SET d=%%x
    			SET t=%%y
    			goto CreateBackup
    		)
    	)
    )
    REM --- No log files yet
    goto LaunchMediaPortal
    
    
    :CreateBackup
    	REM --- Create filename stamp
    	SET DateStamp=%d%_%t:~0,2%;%t:~3,2%;%t:~6,2%.%t:~9,6%
    	IF NOT EXIST "%BackupFolder%" mkdir "%BackupFolder%"
    
    	REM --- Create actual backup on LOG files
    	%Zip% a "%BackupFolder%\Backup.Log (%DateStamp%).7z" *.bak *.log
    
    	REM --- Cleanup on aisle five for LOG files
    	IF EXIST *.bak del *.bak
    	del *.log
    
    	REM --- Create actual backup on DATABASE files
    	cd %DatabaseFolder%
    	%Zip% a "%BackupFolder%\Backup.Database (%DateStamp%).7z" *.db3
    goto LaunchMediaPortal
    
    
    :LaunchMediaPortal
    	REM --- Locating MediaPortal folder
    	IF EXIST "%ProgramFiles%\Team MediaPortal\MediaPortal\MediaPortal.exe"  (
    		start "MediaPortal" "%ProgramFiles%\Team MediaPortal\MediaPortal\MediaPortal.exe"
    	) ELSE (
    		IF EXIST "%ProgramFiles(x86)%\Team MediaPortal\MediaPortal\MediaPortal.exe"  (
    			start "MediaPortal" "%ProgramFiles(x86)%\Team MediaPortal\MediaPortal\MediaPortal.exe"
    		) ELSE (
    			Goto MediaPortalNotFound
    		)
    	)
    goto EndBat
    
    
    :MediaPortalIsRunning
    	echo   WARNING: MediaPortal is still running!!
    	echo.
    	echo     For proper backup files, please close MediaPortal first.
    	echo     Besides it is dangerous to start it more then once.
    goto ExitDelay
    
    
    :MediaPortalNotFound
    	echo   WARNING: MediaPortal *NOT* Found!!
    	echo.
    	echo     Unable to locate MediaPortal in the default location.
    	echo     Please adjust this script manually to use your custom folder.
    goto ExitDelay
    
    :ExitDelay
    	echo.
    	echo   This window will self-destruct in a few seconds.
    	echo.
    	%Delay% > nul
    goto EndBat
    
    
    :EndBat
    REM --- All done
    [/collapse]

    Enjoy.
     

    flixxx

    Portal Pro
    December 7, 2007
    68
    0
    If it was me, I would worry more on the 'why' my system crashes instead of trying to fight the symptoms.

    Use a script otherwise to backup your database with a datestamp before you launch MediaPortal, that way you can always go back to any point in time you wish when corruption occurs.

    The following script is what I use myself:

    [collapse]
    Code:
    @Echo Off
    REM Script to backup important files with date/time stamp, before launching MediaPortal.
    REM It also makes sure MediaPortal is not already running.
    REM Last Modified: March 1st 2010
    REM Author: RoChess
    
    cls
    echo.
    
    SET LogFolder="%ProgramData%\Team MediaPortal\MediaPortal\log\"
    SET DatabaseFolder="%ProgramData%\Team MediaPortal\MediaPortal\database\"
    
    SET BackupFolder=%UserProfile%\Desktop\MediaPortal Backups
    SET Zip="C:\Program Files\7-Zip\7z.exe"
    SET Delay=ping 1.1 -n 1 -w 5000
    
    
    REM --- Check if MediaPortal is still running
    tasklist | find /i /c "MediaPortal.exe" &&goto MediaPortalIsRunning
    tasklist | find /i /c "PluginConfigLoader.exe" &&goto MediaPortalIsRunning
    
    
    IF NOT EXIST %Zip% (
    	echo   WARNING: 7-Zip program is required to compress the backup files.
    	echo.
    	echo     Please install it into: %Zip%
    	goto ExitDelay
    )
    
    
    IF NOT EXIST %LogFolder% (
    	echo   WARNING: MediaPortal.log file can not be found.
    	echo.
    	echo     Please edit this batch file to correct the "LogFolder".
    	goto ExitDelay
    ) ELSE (
    	cd %LogFolder%
    	IF EXIST MediaPortal.log (
    		REM --- Use log file for stamp info
    		FOR /F "eol=[ tokens=1,2" %%x IN (MediaPortal.log) DO (
    			SET d=%%x
    			SET t=%%y
    			goto CreateBackup
    		)
    	)
    )
    REM --- No log files yet
    goto LaunchMediaPortal
    
    
    :CreateBackup
    	REM --- Create filename stamp
    	SET DateStamp=%d%_%t:~0,2%;%t:~3,2%;%t:~6,2%.%t:~9,6%
    	IF NOT EXIST "%BackupFolder%" mkdir "%BackupFolder%"
    
    	REM --- Create actual backup on LOG files
    	%Zip% a "%BackupFolder%\Backup.Log (%DateStamp%).7z" *.bak *.log
    
    	REM --- Cleanup on aisle five for LOG files
    	IF EXIST *.bak del *.bak
    	del *.log
    
    	REM --- Create actual backup on DATABASE files
    	cd %DatabaseFolder%
    	%Zip% a "%BackupFolder%\Backup.Database (%DateStamp%).7z" *.db3
    goto LaunchMediaPortal
    
    
    :LaunchMediaPortal
    	REM --- Locating MediaPortal folder
    	IF EXIST "%ProgramFiles%\Team MediaPortal\MediaPortal\MediaPortal.exe"  (
    		start "MediaPortal" "%ProgramFiles%\Team MediaPortal\MediaPortal\MediaPortal.exe"
    	) ELSE (
    		IF EXIST "%ProgramFiles(x86)%\Team MediaPortal\MediaPortal\MediaPortal.exe"  (
    			start "MediaPortal" "%ProgramFiles(x86)%\Team MediaPortal\MediaPortal\MediaPortal.exe"
    		) ELSE (
    			Goto MediaPortalNotFound
    		)
    	)
    goto EndBat
    
    
    :MediaPortalIsRunning
    	echo   WARNING: MediaPortal is still running!!
    	echo.
    	echo     For proper backup files, please close MediaPortal first.
    	echo     Besides it is dangerous to start it more then once.
    goto ExitDelay
    
    
    :MediaPortalNotFound
    	echo   WARNING: MediaPortal *NOT* Found!!
    	echo.
    	echo     Unable to locate MediaPortal in the default location.
    	echo     Please adjust this script manually to use your custom folder.
    goto ExitDelay
    
    :ExitDelay
    	echo.
    	echo   This window will self-destruct in a few seconds.
    	echo.
    	%Delay% > nul
    goto EndBat
    
    
    :EndBat
    REM --- All done
    [/collapse]

    Enjoy.

    The system crashes because rtorrent seems to have memory leaks, when I have too many loaded it runs out of memory and kills samba. A reboot will fix it, and rtorrent doesn;t want to acknowledge a problem sooo... that's where i'm at.

    The MP does not crash. That works just fine, but when the server crashes and comes back it rescans all the folders again. So the script won't work because MP never shuts down to begin with.

    I know they did a big change on the way files get imported and such but i'm wondering if there is a way to stop it from overwritting if an entry already exists.

    (Actually now that i think about it maybe if i rebuild the DB from scratch it will remember the info? as opposed to now it's using the DB from an older version of MP TV Series... I'll try that)
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    The system crashes because rtorrent seems to have memory leaks, when I have too many loaded it runs out of memory and kills samba. A reboot will fix it, and rtorrent doesn;t want to acknowledge a problem sooo... that's where i'm at.

    You can otherwise look into alternatives, such as: qBittorrent official website which as far as I've gotten feedback from *nix friends does not have a memoryleak, and also has more features/support.
     

    acandido

    Portal Member
    November 10, 2007
    7
    0
    Home Country
    Canada Canada
    I'm noticing this problem as well... When MediaPortal comes out of sleep sometimes it cannot read my TV Episodes on a network share and MP TV Series will remove them all from the database. Upon a new import my watched flags have disappeared.

    This is new to ver 2.6.0 as this happened on prior versions but after a new import my watched flags were fine. I've also tried exporting my watched flags when the database is fine, waiting until it deletes/re-imports all the shows, and importing the watched flags; the watched flag import does not seem to take effect and everything appears to be unwatched.
     

    Erazor2

    Portal Member
    September 6, 2007
    11
    0
    Home Country
    Germany Germany
    AW: Re: MP TV Series completely rebuilds database if my server crashes.

    I'm noticing this problem as well... When MediaPortal comes out of sleep sometimes it cannot read my TV Episodes on a network share and MP TV Series will remove them all from the database. Upon a new import my watched flags have disappeared..
    That is exactly what is happening to my computer.
    Everytime I reboot the NAS or network is interrupted I lose all my watched Flags!
     

    flixxx

    Portal Pro
    December 7, 2007
    68
    0
    hey, I was away on the weekend so I haven't had time to play around with it.

    One thing I wanted to try was rebuilding the database from scratch on the new version of MPTvseries.

    Have you guys tried that? Having a brand new DB?

    Let me know if that made a difference, otherwise this is a very big problem for me and I'm sure a lot of others.

    It's only a matter of time before someone gets a server crash, networks issues, power outage, etc.... and their whole database gets wiped out.
     

    acandido

    Portal Member
    November 10, 2007
    7
    0
    Home Country
    Canada Canada
    I've tried rebuilding the DB from scratch on 2.6 and the issue persists. Let me know if you need any more info.
     

    Users who are viewing this thread

    Top Bottom