mchahn 16 Posted January 21, 2023 Share Posted January 21, 2023 The title says it all. I have "Type: "Episode" item data and I'd like to know the complete video file path. Is this possible? Link to comment Share on other sites More sharing options...
Luke 37099 Posted January 22, 2023 Share Posted January 22, 2023 Hi, have you checked item.Path? Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 In my comments I have a old result of item.Path, but I'm not getting it now. Also, it was only a path to the show, not an episode file, like *.mkv. Link to comment Share on other sites More sharing options...
softworkz 3338 Posted January 22, 2023 Share Posted January 22, 2023 1 hour ago, mchahn said: In my comments I have a old result of item.Path, but I'm not getting it now. Also, it was only a path to the show, not an episode file, like *.mkv. What kind of item is it, where does it come from? You could try the "Metadata Explorer" plugin to see which data exists in Emby's DataBase Link to comment Share on other sites More sharing options...
softworkz 3338 Posted January 22, 2023 Share Posted January 22, 2023 Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 I can't find it in the catalog so I'll assume it requires beta. I went to downloads page and there was no option for beta. Where can I download beta? Link to comment Share on other sites More sharing options...
softworkz 3338 Posted January 22, 2023 Share Posted January 22, 2023 15 minutes ago, mchahn said: I can't find it in the catalog so I'll assume it requires beta. I went to downloads page and there was no option for beta. Where can I download beta? Which platform? Link to comment Share on other sites More sharing options...
Cheesegeezer 3087 Posted January 22, 2023 Share Posted January 22, 2023 14 hours ago, mchahn said: The title says it all. I have "Type: "Episode" item data and I'd like to know the complete video file path. Is this possible? //Get The Items in your library. BaseItem[] _itemsList; int _itemsCount; private async Task GetItemIdInEmbyLibraries() { try { Log.Info("Getting Folder(s) Items"); var queryList = new InternalItemsQuery { Recursive = true, IncludeItemTypes = new[] {nameof(Episode)}, MediaTypes = new[] { "Video" }, IsVirtualItem = false, }; _itemsList = LibraryManager.GetItemList(queryList); _itemsCount = _itemsList.Length; Log.Info("Total No. of items in Library {0}", _itemsCount.ToString()); } catch (Exception ex) { Log.Error("No Lib Items Found in Library"); Log.Error(ex.ToString()); } } Then you can do what you want with the _itemsList foreach (var item in _itemsList) { try { var stopWatch = new Stopwatch(); stopWatch.Start(); Log.Info("PROCESSING OF " + item.Name + " HAS STARTED"); Log.Info("Item FilePath = {0} ", item.Path.ToString()); Log.Info("Item Containing Folder = {0} ", item.ContainingFolderPath.ToString()); //Do what you need here, // you can use item.Path or item.ContainingFolderPath //you can also use Emby's IFileSystem and use GetFileNameWithoutExtension if you need to Log.Info("PROCESSING OF {0} HAS COMPLETED", item.Name); _totalProgress++; double dprogress = 100 * (_totalProgress / _totalItems); progress.Report(dprogress); stopWatch.Stop(); Log.Debug("Processing for {0} and took {1} milliseconds", item.Name, (stopWatch.ElapsedMilliseconds).ToString()); } catch(Exception ex) { Log.Error("Error Processing Episode" + ex.ToString()); } } Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 10 hours ago, softworkz said: Which platform? Ubuntu Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 Thanks @Cheesegeezer. It appears that is C++ in some kind of emby plugin environment, correct? I'm using the web-based API so I can't really take advantage of your code. I hope you didn't take the trouble to write any code just for me. Link to comment Share on other sites More sharing options...
Cheesegeezer 3087 Posted January 22, 2023 Share Posted January 22, 2023 11 minutes ago, mchahn said: Thanks @Cheesegeezer. It appears that is C++ in some kind of emby plugin environment, correct? I'm using the web-based API so I can't really take advantage of your code. I hope you didn't take the trouble to write any code just for me. No worries, I didn't write it specially, it's used a lot on my plugins. Can you not take advantage of the ApiClient in your Javascript and call this into a variable. async function getEpisodes() { return await ApiClient.getJSON(ApiClient.getUrl( 'Items?ExcludeLocationTypes=Virtual&Recursive=true&IncludeItemTypes=Episode)); } Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 7 minutes ago, Cheesegeezer said: ApiClient.getUrl I don't know any way to do this in the web api but it may be possible. Is there a way to view the code for getUrl? I have to walk my way through the various level of database items. As I said in my first post I can get a record containg "type":"episode" but that record doesn't have any URL. Link to comment Share on other sites More sharing options...
Cheesegeezer 3087 Posted January 22, 2023 Share Posted January 22, 2023 23 minutes ago, mchahn said: I don't know any way to do this in the web api but it may be possible. Is there a way to view the code for getUrl? I have to walk my way through the various level of database items. As I said in my first post I can get a record containg "type":"episode" but that record doesn't have any URL. Ahhhh right, so you are literally just plugging in a call in the address bar of a browser to get information? So are you scripting? or are you building an application or what? Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 12 minutes ago, Cheesegeezer said: So are you scripting? Yes, from a web app. The JS in the web page makes a call like "http://<hostname>:8096/emby/Users/894c752d448f45a3a1260ccaabd0adff/Items/?ParentId=&X-Emby-Token=<secret>". This can be put into a browser web address for testing. This is the result of using that URL in the browser (using the code function in this post removed the indents pasting). { "item": { "Name": "Episode 6", "ServerId": "ae3349983dbe45d9aa1d317a7753483e", "Id": "4693966", "RunTimeTicks": 34444160000, "IndexNumber": 6, "ParentIndexNumber": 1, "IsFolder": false, "Type": "Episode", "ParentBackdropItemId": "4693962", "ParentBackdropImageTags": [ "422d8fec80b260d654ee657d442065c0" ], "UserData": { "PlaybackPositionTicks": 0, "PlayCount": 1, "IsFavorite": false, "LastPlayedDate": "2022-07-03T03:34:28.0000000Z", "Played": true }, "SeriesName": "Chloe", "SeriesId": "4693962", "SeasonId": "4693964", "SeriesPrimaryImageTag": "d8b85615fedfcfb05ff755b1bbcf9ec2", "SeasonName": "Season 1", "ImageTags": { "Primary": "b8a48ad32271beadf28484d330aa42e0" }, "BackdropImageTags": [], "ParentThumbItemId": "4693962", "ParentThumbImageTag": "c0d51f0b247037cb7ee14c59ac83e10c", "MediaType": "Video" } } Note that the url doesn't have "Fields=" param so all fields are returned. I would like the Path field to appear but it doesn't. Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 Can @softworkz or anyone else tell me how to download the beta server for ubuntu linux? Link to comment Share on other sites More sharing options...
Luke 37099 Posted January 22, 2023 Share Posted January 22, 2023 7 minutes ago, mchahn said: Can @softworkz or anyone else tell me how to download the beta server for ubuntu linux? https://emby.media/download Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 19 minutes ago, Luke said: https://emby.media/download Thanks. I don't know how I missed that. I must not have scrolled down to the beta downloads. 1 Link to comment Share on other sites More sharing options...
Cheesegeezer 3087 Posted January 22, 2023 Share Posted January 22, 2023 42 minutes ago, mchahn said: Yes, from a web app. The JS in the web page makes a call like "http://<hostname>:8096/emby/Users/894c752d448f45a3a1260ccaabd0adff/Items/?ParentId=&X-Emby-Token=<secret>". This can be put into a browser web address for testing. This is the result of using that URL in the browser (using the code function in this post removed the indents pasting). { "item": { "Name": "Episode 6", "ServerId": "ae3349983dbe45d9aa1d317a7753483e", "Id": "4693966", "RunTimeTicks": 34444160000, "IndexNumber": 6, "ParentIndexNumber": 1, "IsFolder": false, "Type": "Episode", "ParentBackdropItemId": "4693962", "ParentBackdropImageTags": [ "422d8fec80b260d654ee657d442065c0" ], "UserData": { "PlaybackPositionTicks": 0, "PlayCount": 1, "IsFavorite": false, "LastPlayedDate": "2022-07-03T03:34:28.0000000Z", "Played": true }, "SeriesName": "Chloe", "SeriesId": "4693962", "SeasonId": "4693964", "SeriesPrimaryImageTag": "d8b85615fedfcfb05ff755b1bbcf9ec2", "SeasonName": "Season 1", "ImageTags": { "Primary": "b8a48ad32271beadf28484d330aa42e0" }, "BackdropImageTags": [], "ParentThumbItemId": "4693962", "ParentThumbImageTag": "c0d51f0b247037cb7ee14c59ac83e10c", "MediaType": "Video" } } Note that the url doesn't have "Fields=" param so all fields are returned. I would like the Path field to appear but it doesn't. All the fields are not returned. You need to specify what you need in the request. I started making a Web Client and i had to add overview, communityRating, etc in order to return that info to display. have you actually done a console.log(“EpisodeInfo: “, episodeVariable); to see what is returned? ill dig out my code for you from it. Out at the moment. So will be a wee while Link to comment Share on other sites More sharing options...
Solution Cheesegeezer 3087 Posted January 22, 2023 Solution Share Posted January 22, 2023 ok so here's what i used to get item path in the variable. This is what i used for what i needed you can remove what you need 192.168.0.117:8096/emby/Users/{userId}/Items/Latest?Limit={itemLimit}&ParentId={folderId}&Fields=Taglines%2CBudget%2CCommunityRating%2COverview%2CMediaStreams&api_key={AuthToken}; But essentially what you are looking for is the container that holds MediaSources in... this will give you your video path, etc 1 Link to comment Share on other sites More sharing options...
Cheesegeezer 3087 Posted January 22, 2023 Share Posted January 22, 2023 What you need is this actually... just tested http://localhost:8096/emby/Users/{currUserId}/Items?Fields=MediaStreams&EnableImages=true&EnableUserData=true&Ids=475746&api_key={AuthToken} // RETURNS THIS { "Items": [ { "Name": "Space Chicken", "ServerId": "8da294d223d1427983f791b4cdb051e5", "Id": "475746", "Container": "mkv", "MediaSources": [ { "Protocol": "File", "Id": "ca99ab49539ac5672254441605cbbc68", "Path": "D:\\Emby_Test\\TV Shows\\House\\Season 02\\House - S02E01E02.mkv", "Type": "Default", "Container": "mkv", "Size": 297031408, "Name": "House - S02E01E02", "IsRemote": false, "RunTimeTicks": 25357350000, "SupportsTranscoding": true, "SupportsDirectStream": true, "SupportsDirectPlay": true, "IsInfiniteStream": false, "RequiresOpening": false, "RequiresClosing": false, "RequiresLooping": false, "SupportsProbing": false, "MediaStreams": [ { "Codec": "mpeg4", "CodecTag": "XVID", "TimeBase": "1/1000", "Title": "SD MPEG-4 Visual [0.7Mb/s]", "VideoRange": "SDR", "DisplayTitle": "SD MPEG-4 Visual [0.7Mb/s]", "IsInterlaced": false, "BitRate": 937105, "BitDepth": 8, "RefFrames": 1, "IsDefault": true, "IsForced": false, "Height": 480, "Width": 720, "AverageFrameRate": 29.97, "RealFrameRate": 29.97, "Profile": "Advanced Simple Profile", "Type": "Video", "AspectRatio": "1.5:1", "Index": 0, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File", "PixelFormat": "yuv420p", "Level": 5, "IsAnamorphic": false, "AttachmentSize": 0 }, { "Codec": "mp3", "TimeBase": "1/1000", "Title": " 2.0 ", "DisplayTitle": "Und 2.0 ", "IsInterlaced": false, "ChannelLayout": "stereo", "BitRate": 192000, "Channels": 2, "SampleRate": 44100, "IsDefault": true, "IsForced": false, "Type": "Audio", "Index": 1, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File", "AttachmentSize": 0 } ], "Formats": [], "Bitrate": 937105, "RequiredHttpHeaders": {}, "ReadAtNativeFramerate": false, "DefaultAudioStreamIndex": 1, "DefaultSubtitleStreamIndex": -1 } ], "RunTimeTicks": 25357350000, "Size": 297031408, "Bitrate": 937105, "IndexNumber": 1, "ParentIndexNumber": 2, "IsFolder": false, "Type": "Episode", "ParentLogoItemId": "287662", "ParentBackdropItemId": "287662", "ParentBackdropImageTags": [ "ecb087239f10dff90e64e11decc359cd", "787c843eb3f13a3420d418c7048f77ba", "53cebe1738af8a1bf740c1126f14fefe" ], "UserData": { "PlayedPercentage": 29.94507793203943, "PlaybackPositionTicks": 7593278219, "PlayCount": 1, "IsFavorite": false, "LastPlayedDate": "2022-11-21T17:05:58.0000000Z", "Played": false }, "SeriesName": "House", "SeriesId": "287662", "SeasonId": "475731", "SeriesPrimaryImageTag": "d3b1479be47a92fbc446447778bc3b82", "SeasonName": "Season 2", "MediaStreams": [ { "Codec": "mpeg4", "CodecTag": "XVID", "TimeBase": "1/1000", "Title": "SD MPEG-4 Visual [0.7Mb/s]", "VideoRange": "SDR", "DisplayTitle": "SD MPEG-4 Visual [0.7Mb/s]", "IsInterlaced": false, "BitRate": 937105, "BitDepth": 8, "RefFrames": 1, "IsDefault": true, "IsForced": false, "Height": 480, "Width": 720, "AverageFrameRate": 29.97, "RealFrameRate": 29.97, "Profile": "Advanced Simple Profile", "Type": "Video", "AspectRatio": "1.5:1", "Index": 0, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File", "PixelFormat": "yuv420p", "Level": 5, "IsAnamorphic": false, "AttachmentSize": 0 }, { "Codec": "mp3", "TimeBase": "1/1000", "Title": " 2.0 ", "DisplayTitle": "Und 2.0 ", "IsInterlaced": false, "ChannelLayout": "stereo", "BitRate": 192000, "Channels": 2, "SampleRate": 44100, "IsDefault": true, "IsForced": false, "Type": "Audio", "Index": 1, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File", "AttachmentSize": 0 } ], "ImageTags": { "Primary": "1d29a444931a106347a50213d74f1a42" }, "BackdropImageTags": [], "ParentLogoImageTag": "92308b003ebccdeb2bdff1ba87b9b99b", "ParentThumbItemId": "287662", "ParentThumbImageTag": "6684e1694566f8d80a109eaed4c3a929", "MediaType": "Video" } ], "TotalRecordCount": 1 } 2 Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 Thank you , thank you. That is exactly what I need. I'm curious how you found out about the MediaSources field. Just curious, don't go to any trouble. Link to comment Share on other sites More sharing options...
softworkz 3338 Posted January 22, 2023 Share Posted January 22, 2023 Please also look here: https://dev.emby.media/doc/restapi/index.html and here: https://dev.emby.media/reference/RestAPI.html We also have client libraries for a variety of languages: https://dev.emby.media/home/sdk/apiclients/index.html 1 1 Link to comment Share on other sites More sharing options...
Cheesegeezer 3087 Posted January 22, 2023 Share Posted January 22, 2023 24 minutes ago, mchahn said: Thank you , thank you. That is exactly what I need. I'm curious how you found out about the MediaSources field. Just curious, don't go to any trouble. i use it a lot in the c# plugins. And by creating UI's i always need to get the mediastreams because they contain codec information which needs to be displayed. And ultimately base transcode decisions on the device against the codec info. Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 22, 2023 Author Share Posted January 22, 2023 Thanks @Luke, @softworks, and @Cheesegeezer for taking the trouble to give awesome support. I wish I could mark multiple posts as the solution. 2 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