Jump to content

c# Get the actual media path


mickle026

Recommended Posts

mickle026
var AllAlbums = libraryManager.GetInternalItemIds(new InternalItemsQuery
{
     IncludeItemTypes = new[] { "MusicAlbum" }
});

foreach (var AlbumEntry in AllAlbums)
{
    var pAlbum = libraryManager.GetItemById(AlbumEntry);
    var AlbumRootPath = pAlbum.Path;
}

@LukeHow do I get the actual media path

works in Emby 4.5.4.0 but not with beta 4.6.0.10 - whats going on?

so  for:

4.5.4.0 Everything works.

4.6.0.10 None work
 

D:\Music\Album\MyMP3.mp3

4.6.0.10 AlbumRootPath = ""
4.5.4.0 AlbumRootPath = "D:\Music\Album\MyMP3.mp3"

but for:

\\MYNAS\Music\Album\MyMP3.mp3

it returns

4.6.0.10 AlbumRootPath = ""
4.5.4.0 AlbumRootPath = "\\MYNAS\Music\Album\MyMP3.mp3"

Note:

var AlbumRootPath = pAlbum.ContainingFolderPath;

Also gives me nothing

I want to get the actual media's path in any location - any help ?

Edited by mickle026
fix typos
Link to comment
Share on other sites

Hi.  A music album is a virtual item that can be derived from tag information.  Therefore, it doesn't really have a physical path.  You could get a path from one of the songs though.

Link to comment
Share on other sites

mickle026
36 minutes ago, ebr said:

Hi.  A music album is a virtual item that can be derived from tag information.  Therefore, it doesn't really have a physical path.  You could get a path from one of the songs though.

So why does it work in 4.5.4.0 ?

You get the root of the Album

4.5.4.0 AlbumRootPath = "D:\Music\Album\"

it returns the root folder path as you would expect

in

4.6.0.10 AlbumRootPath = ""

if i get it from one of the songs im not necessarily going to get the top directory as music might be in serveral subfolders deep.

 

Now that music is getting a rewrite is it no longer being stored in the database?

 

It has broken one of my plugins :(

Edited by mickle026
Link to comment
Share on other sites

mickle026

I understand all that, but nothing there is actually helpful to fixing my issue with my plugin.

I still need to get the root folder, so I have to rewrite the code to get the tracks, check the main library path, to get the remaining difference in the string

so if I have a track

"\\MYNAS\Music\Album\anything\anything\cd1\MyMP3.mp3"

I have to get the library path

"\\MYNAS\Music\"

then get the file

"\\MYNAS\Music\Album\anything\anything\cd1\MyMP3.mp3"

so i am left with

"Album\anything\anything\cd1\"

So now I can get the Album folder, its not that convenient is it? as oppsed to

var AlbumRootPath = pAlbum.Path;

Now I have to figure out how to get just the album songs in c# :(:(, I only know how to get all the tracks in the library at the moment, not a single albums tracks.

So a load of coding to replace a simple one liner!

:(

 

Any pointers on getting a sinlge albums tracks in c# via the id?

 

Link to comment
Share on other sites

32 minutes ago, mickle026 said:

I understand all that,

Then you should also understand that deriving a "root" path from the songs will not necessarily lead you to an "album" because we do not require that the music be structured that way any more.

If this is for your own use and you know your system will always be structured that way then that is fine but it wouldn't work for just anyone.

Link to comment
Share on other sites

mickle026

I understand, it is still not helpfull if I want to distribute the plugin publicly, it worked before.  Now it will have to work differently which means file structures will have to be updated on every system that uses it. 

The changes mean there is sadly no choice.

Oh well, off we go

 

Thank You for confirming that this change has indeed been implimented.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...