Search the Community
Showing results for tags 'script;'.
-
Script to unmonitor from *Arr apps and Delete Watched items
amateurgod posted a topic in Tools and Utilities
Hey everyone I have finished a script I've been working on. The script will get a user's watched items from emby and then unmonitor them in the relative *Arr app before deleting them from your emby library and filesystem if it has been more than 14 days from the episodes air date (the time limit isn't in place for movies only episodes). You can also blacklist movies and tv shows for the script to ignore feel free to check it out over on GitHub Github - EmbyArrSync -
Would it be possible for emby to scrape .py files as if they were multimedia files? ex: matri.py executing them would be... I have a very interesting idea with Usenet
-
Tested and working on Emby version 4.3.0.30, may not work on other version. I made a script for Greasemonkey, a Firefox addon that allows the user to run homemade scripts and my script issues a bunch of jQuery commands that allows you to maintain a default user template so you don't have to remember all the settings. This is useful in case you want every user to have the same settings and if someone, lets say messes up their display settings then you can just log into admin account and go to Dashboard -> Users -> Username -> Edit this user's profile, image and personal preferences -> Display and then you press F5 so the browser will reload the page and for the script to run. You reload the page every time you want the script to run. But before you run the script you must make a initial setup with your options and user, folder-id's etc. Also, feel free to improve the script, and if you do post it here if you want. Only use it with Firefox's Greasemonkey and not Chrome's Tampermonkey as Tampermonkey does not support hashtags in url's which this script utilizes, you can port it to Tampermonkey and that is very easy but you will have change the @includes and also keep the admin-lockout thing in mind. If script fails to insert settings correctly make sure you adjust the delay for the script, make it so it runs after the page is fully loaded. Default value is 2000 msec (2 sec) search for SCRIPT-TIMER (CTRL+F) in the script to find the line in question. And there is probably a better way to handle this instead of using a timer but my scripting knowledge ain't that good, i tried a bunch of ways to make it execute the script when page was fully loaded but with to success so delay it is. And as always make a backup before you try it, not that it really should be needed as I've been running it for sometime now with no errors and honestly i don't see how it could ruin anything but its better to be safe than sorry. To install it you just download Greasemonkey and make a new userscript and then you copy & paste the code below and edit it so it will work for you, options and user, folder-id's etc. // ==UserScript== // @[member="name"] Emby User Template // @version 4.3.0.30 // @description See description in script. // @author Fr4nsson // @include */web/index.html#!/useredit.html* // @include */web/index.html#!/settings/* // @exclude *useredit.html?userId=2233e73dd2be4c1c87f4c8d835b2f0c3* // @run-at document-idle // @require https://code.jquery.com/jquery-3.4.1.min.js // @[member="grant"] none // ==/UserScript== // // ╓──────────────────────┐ // ║▓│ DESCRiPTiON ▓▓▒▒▒░░│─────────────────────────────────────────────────────┐ // ╙─┼────────────────────┘ │ // ││ │ // ││ This script will automate some of the process when creating or │ // ││ maintaining a user on Emby. This is only tested and working on │ // ││ Emby version 4.3.0.30 and may not work on previous or future │ // ││ versions depending on whether classes gets changed or not which │ // ││ is very likely that they will. I would not recommend using it on │ // ││ future or previous versions of Emby if you don't know what you're │ // ││ doing. │ // ││ │ // ╓─┼──────────────────────┐ │ // ║▓│ INSTALL NOTES ▓▓▒▒▒░░│───────────────────────────────────────────────────┘ // ╙─│──────────────────────┘ // │ // ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ // │ │ // │ ██████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗ │ // │ ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝ │ // │ ██████╔╝█████╗ ███████║██║ ██║██╔████╔██║█████╗ │ // │ ██╔══██╗██╔══╝ ██╔══██║██║ ██║██║╚██╔╝██║██╔══╝ │ // │ ██║ ██║███████╗██║ ██║██████╔╝██║ ╚═╝ ██║███████╗ │ // │ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ │ // │ │ // │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ // │ │ // │ NOTICE......: ONLY USE THIS SCRIPT WITH FIREFOX'S GREASEMONKEY ADDON AND NOT WITH CHROMES TAMPERMONKEY, │ // │ TAMPERMONKEY DOES NOT SUPPORT HASHTAGS IN URLS WHICH THIS SCRIPT UTILIZES. │ // │ │ // │ │ // │ LIBRARY-ID..: This script requires you to edit a few lines of the script in order to make it work for you, you need to replace │ // │ the library datafolderId's where referenced with your own. Search for SWITCH-THIS-ID in this script (CTRL + F). │ // │ You will find your Id's in by going to your dashboard and clicking on a library NAME (Don't edit the library) │ // │ │ // │ And you will be taken to the ordinary library page that any regular user can visit and that holds the content of │ // │ said library, check at the end of the address bar in the browser and you'll find something like this │ // │ parentId=9ec840fc98bc99fab0bc952ee46828ad that is your Id for that library. │ // │ │ // │ │ // │ EXCLUDE.....: The Id listed in at-exclude at the top is the Id of the admin user, switch it out with yours to prevent lockout │ // │ incase of #chkIsAdmin checked is false in the script. By default you don't have to worry about this since its only │ // │ activated if you uncomment that specific line. Want to know your userId? its the same procedure as │ // │ (see LIBRARY-ID above) except its for users. │ // │ │ // │ │ // │ AUTOSAVE....: Automatically save in dashboard is active by default, don't want this? search for AUTOSAVE in this script (CTRL + F) │ // │ │ // │ │ // │ HOW-TO-USE..: Everytime you reload the page the script will run, so say someone screwed up all their display settings, then you │ // │ enter Dashboard -> Users -> Username -> Edit this user's profile, image and personal preferences -> Display and │ // │ then you press F5 so the browser will reload the page and for script to run. You reload the page everytime you │ // │ want the script to run. │ // │ │ // │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ // └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ var $ = window.$ // This is not really needed, but it removes the error messages that is created because jQuery (https://code.jquery.com/jquery-3.4.1.min.js) is not loaded here, it will be loaded when the script triggers which will only happen at url listed in at-include. $(document).ready(function() { //When document has loaded setTimeout(function() { // ───────────────────────────────────────────────────────────────────────────── // ----------------------------- SCRIPT START ---------------------------------- // ───────────────────────────────────────────────────────────────────────────── // // ICON LEGEND: // ☐ = Checkbox // ▼ = Drop down menu // //╓──────────────────────┐ //║▓│ ADMIN PANEL ▓▓▒▒▒░░│─────────────────────────────────────────────────────────────────────────────────────────────────────────────── //╙──────────────────────┘ │ //╓────────────────┐ │ //║▓│ PROFILE │──────────┘ //╙────────────────┘ // ☐ Allow remote connections to this Emby Server. $( "#chkRemoteAccess" ).prop( "checked", true ); // // ☐ Allow this user to manage the server - Uncommenting the line below can cause lockout read readme at top //$( "#chkIsAdmin" ).prop( "checked", false ); // //┌────────────────┐ //│ Feature Access │ //└────────────────┘ // ☐ Allow Live TV access. $( "#chkEnableLiveTvAccess" ).prop( "checked", true ); // // ☐ Allow Live TV recording management. $( "#chkManageLiveTv" ).prop( "checked", false ); // //┌────────────────┐ //│ Media Playback │ //└────────────────┘ // ☐ Allow media playback. $( "#chkEnableMediaPlayback" ).prop( "checked", true ); // // ☐ Allow audio playback that requires transcoding. $( "#chkEnableAudioPlaybackTranscoding" ).prop( "checked", false ); // // ☐ Allow video playback that requires transcoding. $( "#chkEnableVideoPlaybackTranscoding" ).prop( "checked", false ); // // ☐ Allow video playback that requires conversion without re-encoding. $( "#chkEnableVideoPlaybackRemuxing" ).prop( "checked", true ); // // ▼ Max simultaneous video streams: (For this user, not global). $('select#selectStreamLimit').prop('selectedIndex', 1); /* IndexGuide: 0-50,0=Unlimited,1=1,2=2,3=3,4=4,5=5... */ // // Internet streaming bitrate limit (Mbps): // No Code Yet // //┌───────────────────────────┐ //│ Allow Media Deletion From │ //└───────────────────────────┘ // ☐ All libraries $( "#chkEnableDeleteAllFolders" ).prop( "checked", false ); // //┌────────────────┐ //│ Remote Control │ //└────────────────┘ // ☐ Allow remote control of other users $( "#chkEnableRemoteControlOtherUsers" ).prop( "checked", false ); // // ☐ Allow remote control of shared devices $( "#chkRemoteControlSharedDevices" ).prop( "checked", true ); // //┌───────────┐ //│ Downloads │ //└───────────┘ // ☐ Allow media downloading $( "#chkEnableDownloading" ).prop( "checked", false ); // // ☐ Allow media downloading that requires transcoding $( "#chkEnableSyncTranscoding" ).prop( "checked", false ); // //┌───────────┐ //│ Subtitles │ //└───────────┘ // ☐ Allow subtitle downloading $( "#chkEnableSubtitleDownloading" ).prop( "checked", false ); // // ☐ Allow deletion of existing subtitle files $( "#chkEnableSubtitleManagement" ).prop( "checked", false ); // // ☐ Allow media conversion $( "#chkEnableConversion" ).prop( "checked", false ); // // ☐ Allow social media sharing $( "#chkEnableSharing" ).prop( "checked", false ); // // ☐ Allow this user to change their password and profile image $( "#chkAllowChangeProfile" ).prop( "checked", false ); // // ☐ Disable this user $( "#chkDisabled" ).prop( "checked", false ); // // ☐ Hide this user from login screens on the local network $( "#chkIsHidden" ).prop( "checked", true ); // // ☐ Hide this user from login screens when connected remotely $( "#chkIsHiddenRemotely" ).prop( "checked", true ); // //╓──────────────────────┐ //║▓│ ADMIN PANEL ▓▓▒▒▒░░│─────────────────────────────────────────────────────────────────────────────────────────────────────────────── //╙──────────────────────┘ │ //╓────────────────┐ │ //║▓│ ACCESS │──────────┘ //╙────────────────┘ // ☐ Enable access to all libraries $( "#chkEnableAllFolders" ).prop( "checked", true ); // // ☐ Enable access from all devices $( "#chkEnableAllDevices" ).prop( "checked", true ); // //╓────────────────────────┐ //║▓│ USER SETTINGS ▓▓▒▒▒░░│─────────────────────────────────────────────────────────────────────────────────────────────────────────────── //╙────────────────────────┘ │ //╓────────────────┐ │ //║ DISPLAY │────────────┘ //╙────────────────┘ // ▼ Date time locale: $('.selectDateTimeLocale.emby-select').prop('selectedIndex', 0); // IndexGuide: 0-51,0=Auto(BasedOnDevice),13=English(United States),45=Swedish // // ▼ Theme: $('select#selectTheme').prop('selectedIndex', 1); // IndexGuide: 0-12,0=AppleTV,1=BlueRadiance,2=Dark // // ☐ Allow automatic seasonal themes. $( "#chkSeasonalThemes" ).prop( "checked", false ); // // ▼ Screensaver: $('.selectScreensaver.emby-select').prop('selectedIndex', 0); // // ☐ Enable backdrops. $( "#chkBackdrops" ).prop( "checked", false ); // // ☐ Enable theme songs. $( "#chkThemeSong" ).prop( "checked", false ); // // ☐ Enable theme videos. $( "#chkThemeVideo" ).prop( "checked", false ); // // ☐ Display missing episodes within seasons. $('.chkDisplayMissingEpisodes.emby-checkbox').prop( "checked", false ); // //╓────────────────────────┐ //║▓│ USER SETTINGS ▓▓▒▒▒░░│─────────────────────────────────────────────────────────────────────────────────────────────────────────────── //╙────────────────────────┘ │ //╓────────────────┐ │ //║ HOMESCREEN │────────────┘ //╙────────────────┘ // ▼ Home screen section 1: $('select#selectHomeSection1').prop('selectedIndex', 1); // IndexGuide: 0-8,0=MyMedia,1=MyMedia(Small),2=ActiveRecordings,3=ContinueWatching,4=ContinueListening,5=LatestMedia,6=NextUp,7=LiveTV,8=None // // ▼ Home screen section 2: $('select#selectHomeSection2').prop('selectedIndex', 3); // // ▼ Home screen section 3: $('select#selectHomeSection3').prop('selectedIndex', 6); // // ▼ Home screen section 4: $('select#selectHomeSection4').prop('selectedIndex', 5); // // ▼ Home screen section 5: $('select#selectHomeSection5').prop('selectedIndex', 8); // // ▼ Home screen section 6: $('select#selectHomeSection6').prop('selectedIndex', 8); // // ▼ Home screen section 7: $('select#selectHomeSection7').prop('selectedIndex', 8); // //┌───────────────┐ //│ Library Order │ //└───────────────┘ // List exactly in this order: var ids = ['9d7ad6afe9afa2dab1a2f6e00ad28fa6', // Collections SWITCH-THIS-ID "9d7ad6afe9afa2dab1a2f6e00ad28fa6" etc '9ec840fc98bc99fab0bc952ee46828ad', // Movies SWITCH-THIS-ID '8860bba0ebc5d09e4d27fd85301c257b', // Movies 4K SWITCH-THIS-ID 'b7a798670696afa9a252916ed4f11f47', // TV Series SWITCH-THIS-ID 'c08a027359459c36152044a7dca3df81', // TV Series (Animated) SWITCH-THIS-ID '7e64e319657a9516ec78490da03edccb']; // Music SWITCH-THIS-ID for (var i = ids.length - 1; i > 0; i--) { $('.listItem.viewItem[data-viewid="'+ids[i-1]+'"]').insertBefore('.listItem.viewItem[data-viewid="'+ids[i]+'"]'); }; //┌─────────────┐ //│ Collections │ //└─────────────┘ // ☐ Display on Homescreen. $('.chkIncludeInMyMedia.emby-checkbox[data-folderid="9d7ad6afe9afa2dab1a2f6e00ad28fa6"]').prop( "checked", true ); // Collections SWITCH-THIS-ID "9d7ad6afe9afa2dab1a2f6e00ad28fa6" etc // //┌────────┐ //│ Movies │ //└────────┘ // ☐ Display in home screen sections such as latest media and continue watching. $('.chkIncludeInLatest.emby-checkbox[data-folderid="9ec840fc98bc99fab0bc952ee46828ad"]').prop( "checked", true ); // Movies SWITCH-THIS-ID // //┌───────────┐ //│ Movies 4K │ //└───────────┘ // ☐ Display in home screen sections such as latest media and continue watching. $('.chkIncludeInLatest.emby-checkbox[data-folderid="8860bba0ebc5d09e4d27fd85301c257b"]').prop( "checked", true ); // Movies 4K SWITCH-THIS-ID // //┌───────────┐ //│ TV Series │ //└───────────┘ // ☐ Display in home screen sections such as latest media and continue watching. $('.chkIncludeInLatest.emby-checkbox[data-folderid="b7a798670696afa9a252916ed4f11f47"]').prop( "checked", true ); // TV Series SWITCH-THIS-ID // //┌──────────────────────┐ //│ TV Series (Animated) │ //└──────────────────────┘ // ☐ Display in home screen sections such as latest media and continue watching. $('.chkIncludeInLatest.emby-checkbox[data-folderid="c08a027359459c36152044a7dca3df81"]').prop( "checked", true ); // TV Series (Animated) SWITCH-THIS-ID // //┌───────┐ //│ Music │ //└───────┘ // ☐ Display in home screen sections such as latest media and continue watching. $('.chkIncludeInLatest.emby-checkbox[data-folderid="7e64e319657a9516ec78490da03edccb"]').prop( "checked", false ); // Music SWITCH-THIS-ID // // ▼ Default Screen. $('.selectLanding.emby-select[data-folderid="7e64e319657a9516ec78490da03edccb"]').prop('selectedIndex', 6); // IndexGuide: 0=Suggestions,1=Albums,2=AlbumArtists,3=Artists,4=Playlists,5=Genres,6=Folders SWITCH-THIS-ID // // ☐ Hide watched content from latest media. $('.chkHidePlayedFromLatest.emby-checkbox').prop( "checked", true ); // //╓────────────────────────┐ //║▓│ USER SETTINGS ▓▓▒▒▒░░│─────────────────────────────────────────────────────────────────────────────────────────────────────────────── //╙────────────────────────┘ │ //╓────────────────┐ │ //║ PLAYBACK │────────────┘ //╙────────────────┘ //┌────────────────┐ //│ Audio Settings │ //└────────────────┘ // ▼ Prefered audio language: $('select#selectAudioLanguage').prop('selectedIndex', 81); // IndexGuide: 0-188,English=42,Japaneese=81 - Default is Japaneese because no one wants to listen to english-dubbed animes. // // ☐ Play default audio track regardless of language. $('.chkPlayDefaultAudioTrack.emby-checkbox').prop( "checked", false ); // //┌──────────┐ //│ Advanced │ //└──────────┘ // ☐ Play next episode automatically. $('.chkEpisodeAutoPlay.emby-checkbox').prop( "checked", true ); // // ☐ Enable next video info during playback. $('.chkEnableNextVideoOverlay.emby-checkbox').prop( "checked", true ); // // ▼ Skip forward length: In Seconds. $('.selectSkipForwardLength.emby-select').prop('selectedIndex', 1); // IndexGuide: 0-5,0=5s,1=10s,2=15,3=20,4=25,5=30 // // ▼ Skip back length: $('.selectSkipBackLength.emby-select').prop('selectedIndex', 1); // IndexGuide: 0-5,0=5s,1=10s,2=15,3=20,4=25,5=30 // // ☐ Enable 'Are You Still Watching?' prompt. $('.chkStillWatching.emby-checkbox').prop( "checked", true ); // //╓────────────────────────┐ //║▓│ USER SETTINGS ▓▓▒▒▒░░│─────────────────────────────────────────────────────────────────────────────────────────────────────────────── //╙────────────────────────┘ │ //╓────────────────┐ │ //║ SUBTITLES │────────────┘ //╙────────────────┘ // ▼ Preferred subtitle language: $('select#selectSubtitleLanguage').prop('selectedIndex', 42); // IndexGuide: 0-188,English=42 // // ▼ Subtitle mode: $('select#selectSubtitlePlaybackMode').prop('selectedIndex', 3); // IndexGuide: 0-4,0=Default,1=Smart,2=OnlyForcedSubtitles,3=AlwaysPlaySubtitles,4=NoSubtitles // //┌─────────────────────┐ //│ Subtitle Appearance │ //└─────────────────────┘ // ▼ Text size: $('select#selectTextSize').prop('selectedIndex', 2); // IndexGuide: 0-5,0=Smaller,1=Small,2=Normal,3=Large,4=Larger,5=ExtraLarge // // ▼ Text color: $('select#inputTextColor').prop('selectedIndex', 3); // IndexGuide: 0-4,0=Pink,1=Orange,2=Yellow,3=White // // ▼ Drop shadow: $('select#selectDropShadow').prop('selectedIndex', 4); // IndexGuide: 0-4,0=None,1=Raised,2=Depressed,3=Uniform,4=DropShadow // //╓──────────────────────────┐ //║▓│ END OF SETTINGS ▓▓▒▒▒░░│─────────────────────────────────────────────────────────────────────────────────────────────────────────────── //╙──────────────────────────┘ // MANUAL SAVE - Scroll to bottom for easier saving - Dashboard //$('html,body').animate({ scrollTop: 9999 }, 'slow'); // // AUTOSAVE - Comment the line below to prevent the script from triggering the "Save Settings" button on useredit.html* $('.raised.button-submit.block.emby-button').trigger("click"); // // ALERT SCRIPT alert('\n\nEmby - User Template Loaded\n\n'); // // ───────────────────────────────────────────────────────────────────────────── // ------------------------------ SCRIPT END ----------------------------------- // ───────────────────────────────────────────────────────────────────────────── }, 2000); //Two seconds will elapse and code will execute. INCREASE THIS IF YOUR PAGE TAKES LONGER TO LOAD, THIS IS IMPORTANT FOR THE SCRIPT TO WORK. SCRIPT-TIMER });