Jump to content


Photo

Reading tags from filesystem

metadata nfo tags

  • Please log in to reply
7 replies to this topic

#1 kRyszard OFFLINE  

kRyszard

    Member

  • Members
  • 25 posts
  • Local time: 07:42 PM

Posted 01 June 2018 - 04:19 PM

I use emby as a server for large amount of pictures. I put all my pictures for emby to manage but I don't want some of them to be seen by my family so I tag my private folders with a tag named "priv" and I use the "block items with tags" to deny access (yes, I use parental control on my parents). However it would be more convenient for me if I could somehow add the tag from the filesystem level e.g. create a file named "folder.nfo" or similar and put the tags there. The advantage is that these files would be automatically backed up along with the content to some other drive. Other advantage: it's faster to copy a file than to click, scroll, type, click and click again in web client for every folder I want to exclude.



#2 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 135027 posts
  • Local time: 02:42 PM

Posted 04 June 2018 - 12:50 PM

Hi, there currently isn't a folder.nfo I'm afraid, although it's not a bad idea. So currently you would have to do this inside Emby with the metadata editor.



#3 kRyszard OFFLINE  

kRyszard

    Member

  • Members
  • 25 posts
  • Local time: 07:42 PM

Posted 03 July 2018 - 04:01 PM

Decided to write a script that crawls inside my filesystem, reads files with tags and uses emby rest interface to set/unset tags.



#4 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 135027 posts
  • Local time: 02:42 PM

Posted 03 July 2018 - 06:01 PM

Interesting, thanks for the info.



#5 mastrmind11 OFFLINE  

mastrmind11

    Advanced Member

  • Members
  • 2727 posts
  • Local time: 02:42 PM
  • LocationLong Island, NY

Posted 03 July 2018 - 06:54 PM

Decided to write a script that crawls inside my filesystem, reads files with tags and uses emby rest interface to set/unset tags.

Perhaps you can clean it up and share it for others that might find it useful?



#6 kRyszard OFFLINE  

kRyszard

    Member

  • Members
  • 25 posts
  • Local time: 07:42 PM

Posted 19 August 2018 - 04:49 PM

Hello, I have finished the program I mentioned. This prog crawls the Emby repositories and for every folder it visits it checks for a presence of a special file that causes a tag called "priv" to be put on the folder. This tag is then used for parental control for some users i.e. blocks access to the folders containing a special file.

 

Github: https://github.com/mr-rycho/embian

Bin: http://kryszard.vot....n/embian.01.zip



#7 bgx OFFLINE  

bgx

    Advanced Member

  • Members
  • 151 posts
  • Local time: 08:42 PM
  • LocationGermany

Posted 02 September 2018 - 06:24 AM

Oh great @kRyszard it seems that this is exactly what I want. Can I write other tags? And how to use it? I'm on pure linux debian...
 
Can I mass write tags? Like for all episodes of a tvseries?
 
EDIT: Ok got it, but can't login:

java -jar embian.jar --host "http://192.168.177.98" --pass xxx --user xxx browse
Exception in thread "main" javax.ws.rs.ProcessingException: java.net.UnknownHostException: 192.168.177.98Users
        at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287)
        at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:253)
        at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:759)
        at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:756)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:407)
        at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:756)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:443)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:349)
        at pl.rychu.embian.emby.EmbyClientFactory.authenticate(EmbyClientFactory.java:35)
        at pl.rychu.embian.Main.lambda$main$0(Main.java:63)
        at pl.rychu.embian.browse.Browse.exec(Browse.java:35)
        at pl.rychu.embian.Main.main(Main.java:79)
Caused by: java.net.UnknownHostException: 192.168.177.98Users
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.www.http.HttpClient.openServer(Unknown Source)
        at sun.net.www.http.HttpClient.openServer(Unknown Source)
        at sun.net.www.http.HttpClient.<init>(Unknown Source)
        at sun.net.www.http.HttpClient.New(Unknown Source)
        at sun.net.www.http.HttpClient.New(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
        at org.glassfish.jersey.client.internal.HttpUrlConnector$4.getOutputStream(HttpUrlConnector.java:390)
        at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200)
        at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:194)
        at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:228)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299)
        at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
        at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
        at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
        at sun.nio.cs.StreamEncoder.flush(Unknown Source)
        at java.io.OutputStreamWriter.flush(Unknown Source)
        at org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:193)
        at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:130)
        at org.glassfish.jersey.message.internal.AbstractFormProvider.writeTo(AbstractFormProvider.java:116)
        at org.glassfish.jersey.message.internal.FormProvider.writeTo(FormProvider.java:112)
        at org.glassfish.jersey.message.internal.FormProvider.writeTo(FormProvider.java:66)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1126)
        at org.glassfish.jersey.client.ClientRequest.doWriteEntity(ClientRequest.java:517)
        at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:499)
        at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:393)
        at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
        ... 14 more

EDIT: Got it but now other error:

java -jar embian.jar --host "http://192.168.177.98/" --pass xxx --user xxx browse
Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 5 path $
        at com.google.gson.Gson.fromJson(Gson.java:939)
        at com.google.gson.Gson.fromJson(Gson.java:892)
        at com.google.gson.Gson.fromJson(Gson.java:841)
        at com.google.gson.Gson.fromJson(Gson.java:813)
        at pl.rychu.embian.emby.EmbyClientFactory.authenticate(EmbyClientFactory.java:39)
        at pl.rychu.embian.Main.lambda$main$0(Main.java:63)
        at pl.rychu.embian.browse.Browse.exec(Browse.java:35)
        at pl.rychu.embian.Main.main(Main.java:79)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 5 path $
        at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:183)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)
        at com.google.gson.Gson.fromJson(Gson.java:927)
        ... 7 more

Edited by bgx, 02 September 2018 - 06:47 AM.


#8 kRyszard OFFLINE  

kRyszard

    Member

  • Members
  • 25 posts
  • Local time: 07:42 PM

Posted 04 September 2018 - 02:48 AM

DzieƄdoberek :)

 

Regarding the exception:

  • one possibility is that you have some older emby server version that my client cannot talk to i.e. cannot recognize its answer. what emby version do you have?
  • are you sure the user and pass are correct? sorry, i'm not sure right now but the "host" parameter should probably also contain the appname and trainling slash i.e. "http://192.168.177.98/web/"(i'm not sure right now what is the correct app name because I have apache in front of emby and use some url mapping)
  • yes, the authentication part definitely lacks proper error handling and the documentation lack proper "host" param description

Regarding the tags: currently embian handles only the "priv" tag but I'm currently thinking of extending it. I think about two possibilities:

  • embian should handle only tags with prefix "priv" so for example when it finds "priv-all" and "priv-family" tags on emby folder and only ".emby.tag.priv-family" in the filesystem then embian should delete "priv-all" from the folder
  • embian should handle all tags so it will delete any tag for which there is no corresponding ".emby.tag.X" file in the filesystem

Please describe your usecase with these tv series i.e. do you want to sync tags with special tag files in filesystem or rather want to recursively add some tag i.e. in command line pass starting folder and tag name and make embian tag all files (and/or directiories) in all subdirectories.







Also tagged with one or more of these keywords: metadata, nfo, tags

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users