INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Auto-Import reading directory name for Album  (Read 6388 times)

eezetee

  • World Citizen
  • ***
  • Posts: 208
Auto-Import reading directory name for Album
« on: December 12, 2015, 01:12:06 am »

I've created a directory structure for my family albums for specific people.

For example
\Media\Images\Person1
\Media\Images\Person2

But whenever I import the \Media\Images folder,  all of the images have an album name automatically tag'd with the date of the image.

Is there any way I can pluck out the Person1 name and that way all of that Person's images are in their own album or alteast Tag'd with their name and I can create an Album later?

I know how I can do with this with a specific Person1 import but i'm trying to avoid doing that for many people

Thanks
Logged

eezetee

  • World Citizen
  • ***
  • Posts: 208
Re: Auto-Import reading directory name for Album
« Reply #1 on: December 12, 2015, 10:06:19 pm »

I think i might have gotten it to work to based on glynor's post here

Under the auto-import, chose my Images auto-import,  then Edit, then "Apply these tags (optional)

Field: Album
Value: If(IsEqual([Filename],\Media\Images\People\Person1,8),Person1,[Album])

It checks the filename (location) condition to see if it matches \Media\Images\People\Person1
   The 8 is for a substring, case insensitive

If the condition is true (meaning the location is \Media\Images\People\Person1) then set the Album tag to Person1

If it's not true, leave it unchanged to whatever is in the [Album] tag



Hopefully that seems right. If anyone sees an error, do let me know


Logged

eezetee

  • World Citizen
  • ***
  • Posts: 208
Re: Auto-Import reading directory name for Album
« Reply #2 on: December 12, 2015, 10:12:40 pm »

Herein lies a problem.   If I know the name of Person1, that works. 
But what can I do if I have a folder like
\Media\Events\Trips\Europe
\Media\Events\Trips\Michigan\December 2013
\Media\Events\Trips\Michigan\December 2012
\Media\Events\Trips\Thailand

In the case of Michigan above,  I have to create a auto-import tag rule that looks for Michigan and labels everything as Michigan.
What if I wanted to to grab the sub directory name of December 2012 or December 2013 and insert that as the Album tag?
Logged

eezetee

  • World Citizen
  • ***
  • Posts: 208
Re: Auto-Import reading directory name for Album
« Reply #3 on: December 14, 2015, 10:53:08 pm »

Anyone have an idea for me. I'm a bit stuck
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Auto-Import reading directory name for Album
« Reply #4 on: December 15, 2015, 09:59:59 am »

it's a tough one i think, maybe someone will find an easier route.

IF your directory structure is indeed as well formatted as it looks in your example, you could try a

if(isequal(right([filename(path)],4),1,6)....

this should check the last 4 characters in the path and then do a simple check to see if they are a number (greater than 1).  if they are, you can keep the expression going to do whatever, if they aren't you can make that happen (probably ifelse expressions).  you could also do an isrange() instead of isequal(,6) to specify dates rather than just testing for a numeric

you could also parse with regex, it would definitely be better but making a regex takes me a while and i don't have time right now, sorry

edit...just thinking about it, you could probably leverage the date tag (combined with the place tag?)

If(IsEqual([Filename],\Media\Events\Place,8),Place - formatdate(year-month),[Album])

this would assign a Place - Year - Month name to all your albums, even the ones like Thailand (which in your example doesn't have a date subdirectory).  personally i would probably go this route first, with a [Year] first, then for those i wanted the month i'd do a re-run and add (year- month)

some ideas anyways, to be honest i'm not 100% sure what you are trying to accomplish so i might be going the wrong way...
Logged

eezetee

  • World Citizen
  • ***
  • Posts: 208
Re: Auto-Import reading directory name for Album
« Reply #5 on: December 15, 2015, 08:33:23 pm »

it's a tough one i think, maybe someone will find an easier route.

IF your directory structure is indeed as well formatted as it looks in your example, you could try a

if(isequal(right([filename(path)],4),1,6)....

this should check the last 4 characters in the path and then do a simple check to see if they are a number (greater than 1).  if they are, you can keep the expression going to do whatever, if they aren't you can make that happen (probably ifelse expressions).  you could also do an isrange() instead of isequal(,6) to specify dates rather than just testing for a numeric

you could also parse with regex, it would definitely be better but making a regex takes me a while and i don't have time right now, sorry

edit...just thinking about it, you could probably leverage the date tag (combined with the place tag?)

If(IsEqual([Filename],\Media\Events\Place,8),Place - formatdate(year-month),[Album])

this would assign a Place - Year - Month name to all your albums, even the ones like Thailand (which in your example doesn't have a date subdirectory).  personally i would probably go this route first, with a [Year] first, then for those i wanted the month i'd do a re-run and add (year- month)

some ideas anyways, to be honest i'm not 100% sure what you are trying to accomplish so i might be going the wrong way...

Hi Ferday,

Thank you for the ideas. I think the first option may work better although I think I'll need to explain a little bit better as I may have alluded to dates being in everything but that isn't the case.

I have a folder as \Media\Events\Trips

In there, I've got
\Media\Events\Trips\Egypt
\Media\Events\Trips\Europe
\Media\Events\Trips\Michigan\December 2013
\Media\Events\Trips\Michigan\December 2012

Ultimately I'd like JRiver to auto tag based on the characters after the last \

So in the above examples, my albums would be
Egypt
Europe
December 2013
December 2012

Do you think this could work reading in the characters after the last \ ?

Would a regex help?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Auto-Import reading directory name for Album
« Reply #6 on: December 15, 2015, 09:04:26 pm »

I'm pretty sure you want the filefolder() function.

http://wiki.jriver.com/index.php/Expression_Language#FileFolder.28.E2.80.A6.29:_Returns_the_name_of_a_file.27s_parent

It should do exactly what you want with no added stuff at all.  Just literally set [Album] = filefolder()

Read the docs and/or give it a try.  Good luck!

Brian.
Logged

eezetee

  • World Citizen
  • ***
  • Posts: 208
Re: Auto-Import reading directory name for Album
« Reply #7 on: December 16, 2015, 01:20:55 am »

I'm pretty sure you want the filefolder() function.

http://wiki.jriver.com/index.php/Expression_Language#FileFolder.28.E2.80.A6.29:_Returns_the_name_of_a_file.27s_parent

It should do exactly what you want with no added stuff at all.  Just literally set [Album] = filefolder()

Read the docs and/or give it a try.  Good luck!

Brian.

THanks bigentry.  Will give a shot after the weekend. Much appreciated
Logged

eezetee

  • World Citizen
  • ***
  • Posts: 208
Re: Auto-Import reading directory name for Album
« Reply #8 on: December 17, 2015, 08:59:08 pm »

THanks bigentry.  Will give a shot after the weekend. Much appreciated

I can confirm that creating a "Apply these tags (optional)" with

Field = Album
Value = filefolder()

Does indeed work.

Now comes one tricky part.  It's fine if the directory is the single folder like below it will set the Album to be Egypt
\Media\Events\Trips\Egypt

But in the case of multiple trips or a more nested structure, it will show up as December 2013 and not Michigan/December 2013 or "Michigan - December 2013"
\Media\Events\Trips\Michigan\December 2013

So i've got some toying around to do with this.

If anyone has an idea on the above....

Many thanks bigentry, ferday!
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Auto-Import reading directory name for Album
« Reply #9 on: December 17, 2015, 09:13:35 pm »

If you can figure out a pattern to what you are doing, you can use auto import tagging to tag it all correctly.  If not, you should be able to use the same techniques manually to correct whatever comes in strangely.

Read up on filefolder().  It can return the parent folder (like you've tested).  Or the parent of the parent.  Or any directory up the tree.  You can use several calls together like:

=filefolder(,1) - filefolder()

That would return: "Michigan - December 2013"

Doing this after the fact, you can use expressions in the Tagging window and do a lot of these at once if you want.  Keep us posted and good luck.  :)

Brian.
Logged

eezetee

  • World Citizen
  • ***
  • Posts: 208
Re: Auto-Import reading directory name for Album
« Reply #10 on: December 22, 2015, 06:12:59 am »

Thanks Brian.

I'm now toying around with checking to see the directory depth.

I think what i'm settling on is for these examples

1) \Media\Events\Trips\Egypt
2) \Media\Events\Trips\Europe
3) \Media\Events\Trips\Michigan\December 2013
4) \Media\Events\Trips\Michigan\December 2012

For example 1 and 2 i'd like to see if there is 4 \'s in the path which means there are no subdirectors after Egypt and Europe.

But if there are five \'s as in example 3 and 4, then use the filefolder(-1) - filefolder()  option

Is that possible?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Auto-Import reading directory name for Album
« Reply #11 on: December 22, 2015, 09:54:54 am »

The filefolder() function will return any "level" of the structure that you want.  When you try to go too far up the chain of directories, it will return an empty string.  So you can use it to test the depth!  Here's a quickie expression I just put together to test:

Code: [Select]
if(isempty(FileFolder(,6)),Less Than 7 levels,At least 7 levels)
I think you could use 3 for your depth and trigger this test correctly.  Just substitute your expression in place of the text I have in the if statement.  I hope that makes sense.  Mess with it as an expression column and I'm sure you'll get it working.

Good luck!

Brian.
Logged

eezetee

  • World Citizen
  • ***
  • Posts: 208
Re: Auto-Import reading directory name for Album
« Reply #12 on: December 26, 2015, 09:08:21 pm »

Hi All,

Just an updated. I had some help via email from a kind gentlemen and during those discussions, my thoughts on how I should handle the sorting of my data, views and the ultimate decision to tag on auto-import or use these views. I think i've opted to use the views as it's quite powerful and I can easily see if ive missed or incorrectly tagged something

What was created is a paned view, with the expressions and a explanation

Here is the expressions
Column 1:
Code: [Select]
listitem([filename (path)], 4, \)
Explanation: The ListItem() function splits a string on the named separator, in this case \, and returns the designated component.

Column 2:
Code: [Select]
regex([Filename (path)], /#.*?\\Media\\Images\\[^\\]+\\(.+)$#/, 1)&datatype=[list]
Explanation: matches the pattern of anything followed by the string "\Media\Images", and then followed by any sequence of 1 or more non-\ characters, followed by a \, and then anything else.  The ( ) chars remember what was matched (captured) in those positions.  And the 1 in the Regex() returns the value of capture #1.  The
Code: [Select]
&datatype=[list] forces the resulting string to be interpreted as a hierarchy (a collapsible list in a pane, a drill down sequence in a categories view), and the \ char in a list is the reserved hierarchy list separator in MC views.

Column 3:
Code: [Select]
Replace(regex([Filename (path)], /#.*?\\Media\\Images\\[^\\]+\\(.+)$#/, 1), \, ;)&datatype=[list]
Explanation: Similar to column 2 but replace the \ list hierarchy separator with a semicolon, as semicolons are list item terminators (e.g. "a; b; c" will be shown as individual items a, and b, and c in a list).

Hopefully the above helps someone else as greatly as the email conversation helped me.  
Logged
Pages: [1]   Go Up