Tango.info track tagger format string: Difference between revisions

From tango.info wiki
Jump to navigation Jump to search
(//$sf["%year%"]=$t["track_year"];//recording date reduced to YYYY)
No edit summary
 
(40 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[category:tango.info]]
[[Category:Tango.info]]
The tango.info tagger since 1.3 (work in progress) accepts a format string for the output.
==Overview==
The [[tango.info track tagger]] since 1.3.2 accepts a format string for the output.


It can be set via the url or input field.
The format string can be set via the input field or via url, e.g.:


http://tools.tango.info/tagger1.3.php?format_string=%25tin%25
https://tango.info/tracktagger/1.4.0?format_string=%25tint%25


==Values==
* %disc_tqty% number of tracks in disc (count in tracks table, CURRENTLY THIS IS NOT THE MAX OF TRACK NUMBER)
* %disc_tqty% number of tracks in disc (count in tracks table, CURRENTLY THIS IS NOT THE MAX OF TRACK NUMBER)
* %album_tqty% number of tracks in album (count in tracks table)
* %album_tqty% number of tracks in a product (count in tracks table)
* %album_dqty% number of discs in album (max value for album_side in tracks table)
* %album_dqty% number of discs in a product (max value for product_side in tracks table)


Aliases exist see below. For work on tags or wishes see [[TIS tags]].
Aliases exist see below.


Available variables can be seen below, all strings in the form %<variable_name>% are variables, e.g. %tin% gives the [[TINP]].
%date% is the raw format as defined in [[tango.info track date]], %year% the year if known.
===List===
To be expanded.
{| class="wikitable sortable"
! Key
! Version
! Description
|-
| in_count
|
| "input count" - row number of the input field. If the input was a [[TINP]], the output is supposed to contain as many output lines as tracks have been found.
|-
| iso_639_3
|
| The [[ISO 639-3]] language code that corresponds to the language of the audio, if any, otherwise 'zxx' for audio without text.
|-
| album_collection
|
| The name of the [[tango.info product collection]], the product belongs to.
|-
| tinp_replacement
| 1.3.5+
| The TINP that replaced the former TINP. Some replacement reasons can be found at [[TINP fix]].
|}
==Source code==
===Latest===
1.4.1
<pre>
<pre>
/*album specific*/
function tif_tagger_output_formatting($t){
$sf["%tin%"]=$t["album_tin"];
$sf["%album_name%"]=$t["album_name"];
//======= output formatting ============
$sf["%album_artist%"]=$t["album_artist"];
 
$sf["%album_pubcode%"]=$t["album_pubcode"];
//===unspecific===
$sf["%album_dqty%"]=$t["album_disc_qty"];
$sf="";
$sf["%album_disc_qty%"]=$sf["%album_dqty%"];//alias
$sf["%in_count%"]=$t["in_count"];
$sf["%album_tqty%"]=$t["album_track_qty"];
//alias
$sf["%x_count%"]=$sf["%in_count%"];
$sf["%out_count%"]=$t["out_count"];
$sf["%comment%"]=$t["comment"];


/*disc specific*/
//===product specific===
$sf["%discnumber%"]=$t["album_side"];
$sf["%tinp%"]=$t["tinp_input"];
$sf["%tin%"]=$t["tinp_input"];
//code reached?
$sf["%tinp_replacement%"]=$t["tinp_replacement"];
$sf["%album_name%"]=$t["product_name"];
//alias
$sf["%album%"]=$t["product_name"];
 
$sf["%album_artist%"]=$t["product_artist"];
//alias
$sf["%album artist%"]=$t["product_artist"];
 
$sf["%album_pubcode%"]=$t["product_pubcode"];
$sf["%album_collection%"]=$t["product_collection"];
//alias
$sf["%album collection%"]=$t["product_collection"];
 
$sf["%album_dqty%"]=$t["product_disc_qty"];
//alias
$sf["%album_disc_qty%"]=$t["product_disc_qty"];
$sf["%album_tqty%"]=$t["product_track_qty"];
//===disc specific===
$sf["%discnumber%"]=$t["side_num"];
$sf["%disc_tqty%"]=$t["track_qty"];
//alias
$sf["%disc_track_qty%"]=$sf["%disc_tqty%"];
//===track specific===
$sf["%tint%"]="{$t["tinp"]}-{$t["side_num"]}-{$t["track_num"]}";
$sf["%track%"]=$t["track_num"];
//alias
$sf["%tracknumber%"]=$t["track_num"];
$sf["%title%"]=$t["track_name"];
$sf["%artist%"]=$t["track_artists"];
$sf["%artist_vocmarker_off%"]=str_replace(", voc. ", ", ",$t["track_artists"]);
$sf["%genre%"]=$t["track_genr"];
$sf["%date%"]=$t["track_date"];
$sf["%year%"]=$t["track_year"];
$sf["%duration%"]=$t["track_dura"];
$sf["%track_orch%"]=$t["track_orch"];
$sf["%track_voca%"]=$t["track_voca"];
 
//===performance specific===
$sf["%tiwc%"]=$t["work_id"];
$sf["%iso_639_3%"]=$t["track_lang"];
//TESTING
$sf["%tidp%"]=$t["tidp"];
//$format_string=urldecode($format_string);
return $sf;
}
</pre>
===1.3.4===
<pre>
//======= output formatting ============
 
//===unspecific===
$sf="";
$sf["%in_count%"]=$in_count;
//alias
$sf["%x_count%"]=$sf["%in_count%"];
$sf["%out_count%"]=$out_count;
$sf["%comment%"]=$comment;
 
//===product specific===
$sf["%tin%"]=$t["product_tin"];
$sf["%album_name%"]=$t["product_name"];
//alias
$sf["%album%"]=$t["product_name"];
 
$sf["%album_artist%"]=$t["product_artist"];
//alias
$sf["%album artist%"]=$t["product_artist"];
 
$sf["%album_pubcode%"]=$t["product_pubcode"];
$sf["%album_collection%"]=$t["product_collection"];
//alias
$sf["%album collection%"]=$t["product_collection"];
 
$sf["%album_dqty%"]=$t["product_disc_qty"];
//alias
$sf["%album_disc_qty%"]=$t["product_disc_qty"];
$sf["%album_tqty%"]=$t["product_track_qty"];
 
//===disc specific===
$sf["%discnumber%"]=$t["product_side"];
$sf["%disc_tqty%"]=$t["track_qty"];
$sf["%disc_tqty%"]=$t["track_qty"];
$sf["%disc_track_qty%"]=$sf["%disc_tqty%"];//alias
//alias
$sf["%disc_track_qty%"]=$sf["%disc_tqty%"];


/*track specific*/
//===track specific===
$sf["%tint%"]="{$t["album_tin"]}-{$t["album_side"]}-{$t["track_num"]}";
$sf["%tint%"]="{$t["product_tin"]}-{$t["product_side"]}-{$t["track_num"]}";
$sf["%track%"]=$t["track_num"];
$sf["%track%"]=$t["track_num"];
//alias
$sf["%tracknumber%"]=$t["track_num"];
$sf["%title%"]=$t["track_name"];
$sf["%title%"]=$t["track_name"];
$sf["%artist%"]=$t["track_artists"];
$sf["%artist%"]=$t["track_artists"];
$sf["%artist_vocmarker_off%"]=str_replace(", voc. ", ", ",$t["track_artists"]);
$sf["%genre%"]=$t["track_genr"];
$sf["%genre%"]=$t["track_genr"];
$sf["%date%"]=$t["track_date"];//tango.info recording date
$sf["%date%"]=$t["track_date"];
//$sf["%year%"]=$t["track_year"];//recording date reduced to YYYY, to be implemented
$sf["%year%"]=$t["track_year"];
$sf["%duration%"]=$t["track_dura"];
$sf["%duration%"]=$t["track_dura"];
$sf["%track_orch%"]=$t["track_orch"];
$sf["%track_orch%"]=$t["track_orch"];
$sf["%track_voca%"]=$t["track_voca"];
$sf["%track_voca%"]=$t["track_voca"];
//===performance specific===
$sf["%tiwc%"]=$t["work_id"];
$sf["%iso_639_3%"]=$t["track_lang"];
</pre>
</pre>
==Notes==
===1.3.4===
Testing %comment% - currently only available for references that are URI. The URI will be in the %comment%.
===1.3.5===
New: %tinp_replacement% - only delivered if the track reference was a TINT

Latest revision as of 2015-08-31T15:40:24

Overview

The tango.info track tagger since 1.3.2 accepts a format string for the output.

The format string can be set via the input field or via url, e.g.:

https://tango.info/tracktagger/1.4.0?format_string=%25tint%25

Values

  • %disc_tqty% number of tracks in disc (count in tracks table, CURRENTLY THIS IS NOT THE MAX OF TRACK NUMBER)
  • %album_tqty% number of tracks in a product (count in tracks table)
  • %album_dqty% number of discs in a product (max value for product_side in tracks table)

Aliases exist see below.

Available variables can be seen below, all strings in the form %<variable_name>% are variables, e.g. %tin% gives the TINP.

%date% is the raw format as defined in tango.info track date, %year% the year if known.

List

To be expanded.

Key Version Description
in_count "input count" - row number of the input field. If the input was a TINP, the output is supposed to contain as many output lines as tracks have been found.
iso_639_3 The ISO 639-3 language code that corresponds to the language of the audio, if any, otherwise 'zxx' for audio without text.
album_collection The name of the tango.info product collection, the product belongs to.
tinp_replacement 1.3.5+ The TINP that replaced the former TINP. Some replacement reasons can be found at TINP fix.

Source code

Latest

1.4.1

function tif_tagger_output_formatting($t){
		
	//======= output formatting ============

	//===unspecific===
	$sf="";
	$sf["%in_count%"]=$t["in_count"];
		//alias
		$sf["%x_count%"]=$sf["%in_count%"];
	$sf["%out_count%"]=$t["out_count"];
	$sf["%comment%"]=$t["comment"];

	//===product specific===
	$sf["%tinp%"]=$t["tinp_input"];
		$sf["%tin%"]=$t["tinp_input"];
	
	//code reached?
	$sf["%tinp_replacement%"]=$t["tinp_replacement"];
		
	$sf["%album_name%"]=$t["product_name"];
		//alias
		$sf["%album%"]=$t["product_name"];

	$sf["%album_artist%"]=$t["product_artist"];
		//alias
		$sf["%album artist%"]=$t["product_artist"];

	$sf["%album_pubcode%"]=$t["product_pubcode"];
	$sf["%album_collection%"]=$t["product_collection"];
		//alias
		$sf["%album collection%"]=$t["product_collection"];

	$sf["%album_dqty%"]=$t["product_disc_qty"];
		//alias
		$sf["%album_disc_qty%"]=$t["product_disc_qty"];
	$sf["%album_tqty%"]=$t["product_track_qty"];
	
	
	//===disc specific===
	$sf["%discnumber%"]=$t["side_num"];		
	$sf["%disc_tqty%"]=$t["track_qty"];
		//alias
		$sf["%disc_track_qty%"]=$sf["%disc_tqty%"];
	
	//===track specific===
	$sf["%tint%"]="{$t["tinp"]}-{$t["side_num"]}-{$t["track_num"]}";
	$sf["%track%"]=$t["track_num"];
		//alias
		$sf["%tracknumber%"]=$t["track_num"];
	$sf["%title%"]=$t["track_name"];
	$sf["%artist%"]=$t["track_artists"];
	$sf["%artist_vocmarker_off%"]=str_replace(", voc. ", ", ",$t["track_artists"]);
	
	$sf["%genre%"]=$t["track_genr"];
	$sf["%date%"]=$t["track_date"];
	$sf["%year%"]=$t["track_year"];
	$sf["%duration%"]=$t["track_dura"];
	$sf["%track_orch%"]=$t["track_orch"];
	$sf["%track_voca%"]=$t["track_voca"];

	//===performance specific===
	$sf["%tiwc%"]=$t["work_id"];
	$sf["%iso_639_3%"]=$t["track_lang"];
	
	//TESTING
	$sf["%tidp%"]=$t["tidp"];
	
	//$format_string=urldecode($format_string);
	return $sf;
}

1.3.4

//======= output formatting ============

//===unspecific===
$sf="";
$sf["%in_count%"]=$in_count;
	//alias
	$sf["%x_count%"]=$sf["%in_count%"];
$sf["%out_count%"]=$out_count;
$sf["%comment%"]=$comment;

//===product specific===
$sf["%tin%"]=$t["product_tin"];
$sf["%album_name%"]=$t["product_name"];
	//alias
	$sf["%album%"]=$t["product_name"];

$sf["%album_artist%"]=$t["product_artist"];
	//alias
	$sf["%album artist%"]=$t["product_artist"];

$sf["%album_pubcode%"]=$t["product_pubcode"];
$sf["%album_collection%"]=$t["product_collection"];
	//alias
	$sf["%album collection%"]=$t["product_collection"];

$sf["%album_dqty%"]=$t["product_disc_qty"];
	//alias
	$sf["%album_disc_qty%"]=$t["product_disc_qty"];
$sf["%album_tqty%"]=$t["product_track_qty"];

//===disc specific===
$sf["%discnumber%"]=$t["product_side"];		
$sf["%disc_tqty%"]=$t["track_qty"];
	//alias
	$sf["%disc_track_qty%"]=$sf["%disc_tqty%"];

//===track specific===
$sf["%tint%"]="{$t["product_tin"]}-{$t["product_side"]}-{$t["track_num"]}";
$sf["%track%"]=$t["track_num"];
	//alias
	$sf["%tracknumber%"]=$t["track_num"];
$sf["%title%"]=$t["track_name"];
$sf["%artist%"]=$t["track_artists"];		
$sf["%artist_vocmarker_off%"]=str_replace(", voc. ", ", ",$t["track_artists"]);

$sf["%genre%"]=$t["track_genr"];	
$sf["%date%"]=$t["track_date"];
$sf["%year%"]=$t["track_year"];
$sf["%duration%"]=$t["track_dura"];
$sf["%track_orch%"]=$t["track_orch"];
$sf["%track_voca%"]=$t["track_voca"];

//===performance specific===
$sf["%tiwc%"]=$t["work_id"];
$sf["%iso_639_3%"]=$t["track_lang"];

Notes

1.3.4

Testing %comment% - currently only available for references that are URI. The URI will be in the %comment%.

1.3.5

New: %tinp_replacement% - only delivered if the track reference was a TINT