IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
Add leading zeroes to dates on convert/move?
Hakuromatsu
post Apr 11 2015, 16:53
Post #1





Group: Members
Posts: 6
Joined: 26-June 11
Member No.: 91841



My dates are all in year.month.day format without leading zeroes, which foobar of course has no problem with and sorts chronologically. However, I use Poweramp on my phone, which sorts dates lexicographically instead of numerically (e.g. 2013.11.13 gets sorted before 2013.5.27).

I need to be able to convert/move my music to my phone and add leading zeroes to the months and days of dates in that format. I'm currently using %album artist%/[%date% - ]%album%/[%discnumber%.]%tracknumber%. %title%[ '('%track artist%')'] -- is there any way to do this? Someone recommended $date(time) but it doesn't seem to work.
Go to the top of the page
+Quote Post
Daeron
post Apr 11 2015, 17:30
Post #2





Group: Members
Posts: 670
Joined: 9-October 08
Member No.: 59818



CODE
$date(%date%)

If you prefer YYYY.MM.DD over YYYY-MM-DD then you can:
CODE
$replace($date(%date%),-,.)

Check:
http://wiki.hydrogenaud.io/index.php?title...tting_Reference

Edit: By the way you can also use %list_index% in case you want to force sort the way the tracks appeared in your playlist (in case it's without any specific pattern).

This post has been edited by Daeron: Apr 11 2015, 17:48
Go to the top of the page
+Quote Post
Hakuromatsu
post Apr 11 2015, 18:21
Post #3





Group: Members
Posts: 6
Joined: 26-June 11
Member No.: 91841



QUOTE (Daeron @ Apr 11 2015, 11:30) *
CODE
$date(%date%)

If you prefer YYYY.MM.DD over YYYY-MM-DD then you can:
CODE
$replace($date(%date%),-,.)

Check:
http://wiki.hydrogenaud.io/index.php?title...tting_Reference

Edit: By the way you can also use %list_index% in case you want to force sort the way the tracks appeared in your playlist (in case it's without any specific pattern).


Thanks for the response!

I'm having trouble getting $date to work. Here's what I had originally and what I'm winding up with after playing around with $date:



(The | in the second is just my cursor.) I've played around with $date a few different ways and can't get the date to output. Without brackets, with YYYY-MM-DD, whatever -- it doesn't output.

This post has been edited by Hakuromatsu: Apr 11 2015, 18:22
Go to the top of the page
+Quote Post
Hakuromatsu
post Apr 11 2015, 19:37
Post #4





Group: Members
Posts: 6
Joined: 26-June 11
Member No.: 91841



Okay, since I can't find an elegant solution I just coded my way out of the problem as inelegantly as possible laugh.gif

CODE
$left(%date%,4).$ifgreater($left($right(%date%,$sub($len(%date%),5)),2),9,$left($right(%date%,$sub($len(%date%),5)),2),$pad_right($left($right(%date%,$sub($len(%date%),5)),1),2,0)).$ifgreater($len(%date%),7,$ifgreater($right(%date%,2),9,$right(%date%,2),$pad_right($right(%date%,1),2,0)),00)


That outputs dates in YYYY.MM.DD format with leading zeroes, from inputted dates that don't have leading zeroes and may only have years and months (or only just years).
Go to the top of the page
+Quote Post
Daeron
post Apr 11 2015, 20:14
Post #5





Group: Members
Posts: 670
Joined: 9-October 08
Member No.: 59818



Hmm, I guess $date() can't interpret the YYYY.(M)M.DD format after all. I'd personally do a mass conversion on your tracks so YYYY-MM-DD is used by default and no further conversion is needed when you push files to your phone.

1) Do a 'Library/Search' with the pattern below. This will filter our operation to the problematic files only.
CODE
%date% HAS .

2) Backup the DATE field of these files, just in case we mess up something in the next step. Select said tracks, 'right click/properties/automatically fill values'. Choose the 'Other...' option from the dropdown menu and input '%date%' to the field. For 'Pattern' choose something like '%date2%'. After pressing OK you'll have a DATE2 field that serves as temporarily copy of DATE.

3) Right click on DATE, select 'split values'. Delete whatever is in the dialog already and input a single '.' (dot) instead. That will break '2015.5.12' down into '2015; 5; 12'.

4) Reassemble the values in DATE using the correct form. To do so, click 'Tools/Automatically fill values...'. Source should be set to 'other' and you should input the code below.
CODE
$num($meta(date,0),4)-$num($meta(date,1),2)-$num($meta(date,2),2)

Pattern should be '%date%'. Check if this is indeed looking good with all your files, click OK.

5) Double check if all files are looking good, if they do, you can delete the DATE2 field.

6) Make sure each new files is formatted correctly before added to your library. Fix them if necessary. Should be much easier to do so for just a few albums.

This post has been edited by Daeron: Apr 11 2015, 20:25
Go to the top of the page
+Quote Post
Hakuromatsu
post Apr 11 2015, 20:19
Post #6





Group: Members
Posts: 6
Joined: 26-June 11
Member No.: 91841



QUOTE (Daeron @ Apr 11 2015, 14:14) *
Hmm, I guess $date() can't interpret the YYYY.(M)M.DD format after all. I'd personally do a mass conversion on your tracks so YYYY-MM-DD is used by default and no further conversion is needed when you push files to your phone.

1) Do a 'Library/Search' with the pattern below. This will filter our operation to the problematic files only.
CODE
%date% HAS .

2) Backup the DATE field of these files, just in case we mess up something in the next step. Select said tracks, 'right click/properties/automatically fill values'. Choose the 'Other...' option from the dropdown menu and input '%date%' to the field. For 'Pattern' choose something like '%date2%'. After pressing OK you'll have a DATE2 field that serves as temporarily copy of DATE.

3) Right click on DATE, select 'split values'. Delete whatever is in the dialog already and input a single '.' (dot) instead. That will break '2015.5.12' down into '2015; 5; 12'.

4) Reassemble the values in DATE using the correct form. To do so, click 'Tools/Automatically fill values...'. Source should be set to 'other' and you should input the code below.
CODE
$num($meta(date,0),2)-$num($meta(date,1),2)-$num($meta(date,2),2)

Pattern should be '%date%'. Check if this is indeed looking good with all your files, click OK.

5) Double check if all files are looking good, if they do, you can delete the DATE2 field.

6) Make sure each new files is formatted correctly before added to your library. Fix them if necessary.


Oh, I found a solution in my second reply to you -- so sorry to make you do more work sad.gif

I appreciate the time you spent though!
Go to the top of the page
+Quote Post
Daeron
post Apr 11 2015, 20:24
Post #7





Group: Members
Posts: 670
Joined: 9-October 08
Member No.: 59818



I actually saw your comment before I wrote the bulk of it. I still think you should fix your tags. Taking care of the root of the problem is better than bandaid fixing. Not to disregard your solution.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 2nd August 2015 - 22:39