zBernie 15 Posted October 14, 2020 Share Posted October 14, 2020 I wrote the PowerShell script below after I found that the Emby backup plugin does not backup movie collections. It copies the collection.xml file for each movie collection to a target directory, displays the movies in each collection, and create an output file named Emby_Movie_Collections.txt with the same information. You will need to change the name "bernie" and the referenced paths, which should not require much effort. Hope you find it useful! $EmbyCollectionsDir = "bernie@ds418:/var/packages/EmbyServer/target/var/data/collections" $TargetDir = "C:\Users\bernie\OneDrive\Documents\Emby_Movie_Collections" $SSHCmd = "C:\WINDOWS\System32\OpenSSH\scp.exe" $ErrorActionPreference = "Continue" Start-Transcript -Path $TargetDir\Emby_Movie_Collections.txt -Append New-Item -ItemType Directory -Force -Path $TargetDir | Out-Null & $SSHCmd -r $EmbyCollectionsDir $TargetDir $XMLFiles = Get-ChildItem -Path C:\Users\bernie\temp -Recurse -Include collection.xml | Select-Object FullName Write-Host "`nProcessing Emby movie collection files in: " $TargetDir "`n" $XMLFiles | ForEach-Object { Process { [xml]$Movies = Get-Content -LiteralPath $_.FullName foreach($Movie in $Movies.Item) { Write-Host "Collection:" $Movie.LocalTitle } foreach($Movie in $Movies.Item.CollectionItems.CollectionItem) { Write-Host $Movie.Path } Write-Host `n }}; Stop-Transcript 1 Link to comment Share on other sites More sharing options...
Luke 37253 Posted October 14, 2020 Share Posted October 14, 2020 Very cool. Thanks for sharing, Link to comment Share on other sites More sharing options...
PenkethBoy 2063 Posted October 14, 2020 Share Posted October 14, 2020 as an alternative Copy-Item -Path "path_to_collections_folder\*" -Destination "Path_to_backup_folder" -Recurse \* is important wrapped in any logging code you want will copy all files from target to destination including sub folders also will copy any other files in collections folder e.g. images 1 Link to comment Share on other sites More sharing options...
zBernie 15 Posted October 14, 2020 Author Share Posted October 14, 2020 7 hours ago, PenkethBoy said: as an alternative Copy-Item -Path "path_to_collections_folder\*" -Destination "Path_to_backup_folder" -Recurse \* is important wrapped in any logging code you want will copy all files from target to destination including sub folders also will copy any other files in collections folder e.g. images This is copying from Linux to Windows, so you need to use scp or some similar tool to copy the files. I originally wrote this because my brother asked me what movies are in my Halloween collection. Link to comment Share on other sites More sharing options...
zBernie 15 Posted October 14, 2020 Author Share Posted October 14, 2020 8 hours ago, Luke said: Very cool. Thanks for sharing, Can you tell me -- if I use the Emby backup plugin, then used the plugin to restore Emby in the event of disaster recovery, would that be sufficient along with restoring the data directory shown below, to restore Emby to it's original state? Is there anything else I should backup? bernie@DS418:/var/packages/EmbyServer/target/var/data$ ls -1 activitylog.db activitylog.db-shm activitylog.db-wal authentication.db authentication.db-shm authentication.db-wal collections connect.txt devices device.txt displaypreferences.db displaypreferences.db-shm displaypreferences.db-wal lastversion.txt library.db library.db-shm library.db-wal playlists ScheduledTasks users.db users.db-shm users.db-wal wan.dat Link to comment Share on other sites More sharing options...
Luke 37253 Posted October 14, 2020 Share Posted October 14, 2020 ^ @cayars Link to comment Share on other sites More sharing options...
Carlo 4331 Posted October 14, 2020 Share Posted October 14, 2020 1 hour ago, zBernie said: Can you tell me -- if I use the Emby backup plugin, then used the plugin to restore Emby in the event of disaster recovery, would that be sufficient along with restoring the data directory shown below, to restore Emby to it's original state? Is there anything else I should backup? bernie@DS418:/var/packages/EmbyServer/target/var/data$ ls -1 activitylog.db activitylog.db-shm activitylog.db-wal authentication.db authentication.db-shm authentication.db-wal collections connect.txt devices device.txt displaypreferences.db displaypreferences.db-shm displaypreferences.db-wal lastversion.txt library.db library.db-shm library.db-wal playlists ScheduledTasks users.db users.db-shm users.db-wal wan.dat No, not from the standpoint of being able to restart Emby and have an instant running system. This would backup all important information about the configuration of the system, the users, the libraries and things like this but you would likely need to reinstall Emby then restore the Emby Config backup and allow it to refresh/download images again (depending if they're stored with media or not). If you want a complete setup that could be put back and ran then that would require a typical backup solution basically an image of the system. Does that help? Link to comment Share on other sites More sharing options...
PenkethBoy 2063 Posted October 14, 2020 Share Posted October 14, 2020 2 hours ago, zBernie said: This is copying from Linux to Windows, so you need to use scp or some similar tool to copy the files. I originally wrote this because my brother asked me what movies are in my Halloween collection. you can do ssh remoting via powershell no need to use other tools unless you want to or symlink the collections folder to a share location and have it for the next time done this for several of the emby "internal" folders which are not available via a share e.g. logs , programdata etc - makes it much easier to manage the nas/linux pc from my main win pc. Link to comment Share on other sites More sharing options...
zBernie 15 Posted October 14, 2020 Author Share Posted October 14, 2020 1 hour ago, cayars said: No, not from the standpoint of being able to restart Emby and have an instant running system. This would backup all important information about the configuration of the system, the users, the libraries and things like this but you would likely need to reinstall Emby then restore the Emby Config backup and allow it to refresh/download images again (depending if they're stored with media or not). If you want a complete setup that could be put back and ran then that would require a typical backup solution basically an image of the system. Does that help? So barring restoring an image of the system, if I reinstalled Emby, then do a restore using the Emby backup plugin, then restore the ../data directory, would that get me close to my previous configuration? -Thanks Link to comment Share on other sites More sharing options...
PenkethBoy 2063 Posted October 14, 2020 Share Posted October 14, 2020 yes to a degree - you would still need to rescan as metadata and cache folder would be empty..... - but you are better off backing up the programdata directory as a whole - and restoring that (with emby off) then you should get emby back to how it was at the point of the backup Link to comment Share on other sites More sharing options...
Carlo 4331 Posted October 14, 2020 Share Posted October 14, 2020 Doing a restore with the Emby Plugin would get your config back. I was just saying it would have to possibly download images again if not stored with media, would need to download cast pics and things like that as well as rebuild the cache, etc... Those all all replaceable items that can be pulled down from the internet so there isn't a need to back them up taking hours vs the quick backup/restore that can be done otherwise. What PenkethBoy said above is good advice. Link to comment Share on other sites More sharing options...
PenkethBoy 2063 Posted October 14, 2020 Share Posted October 14, 2020 Depends if you want an instant restore and go or can wait on a full library scan which could take hours depending how much media you have and settings in the library for chapters/bif's etc Link to comment Share on other sites More sharing options...
zBernie 15 Posted October 14, 2020 Author Share Posted October 14, 2020 1 hour ago, PenkethBoy said: yes to a degree - you would still need to rescan as metadata and cache folder would be empty..... - but you are better off backing up the programdata directory as a whole - and restoring that (with emby off) then you should get emby back to how it was at the point of the backup Thanks, sounds like a reasonable disaster recovery scenario. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now