-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from ben-xo/feature/itunes-season-tag
v1.38 option to output <itunes:season> from TPOS tag
- Loading branch information
Showing
13 changed files
with
346 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,19 +33,19 @@ | |
; The full filesystem path to the MP3 folder | ||
; Set this if you *do not* want the folder to be passed in the URL. | ||
; (This defaults to the same folder as the script) | ||
;MP3_DIR = /home/ben_xo/public_html/my_mp3_folder | ||
;MP3_DIR = "/home/ben_xo/public_html/my_mp3_folder" | ||
|
||
; The base to look for folders if they are specified in the URL | ||
; Set this if you *do* want the folder passed in the URL, but the passed | ||
; folders are not subfolders of where you installed dir2cast.php. | ||
; (This defaults to the same folder as the script) | ||
;MP3_BASE = /home/ben_xo/public_html/ | ||
;MP3_BASE = "/home/ben_xo/public_html/" | ||
|
||
; The URL of the MP3 folder | ||
; This defaults to the directory of the script. | ||
; dir2cast can usually work this out for you, but under some circumstances | ||
; it will fail. If your MP3 URLs are all wrong, try putting this in manually. | ||
;MP3_URL = http://www.example.foo/my_mp3_folder/ | ||
;MP3_URL = "http://www.example.foo/my_mp3_folder/" | ||
|
||
; Uncomment this if you want to check in every sub-folder for new files as well. | ||
;RECURSIVE_DIRECTORY_ITERATOR = true | ||
|
@@ -70,7 +70,7 @@ | |
|
||
; Email of the Author of the podcast for iTunes | ||
; This defaults to empty | ||
;ITUNES_OWNER_EMAIL = [email protected] | ||
;ITUNES_OWNER_EMAIL = "[email protected]" | ||
|
||
; URL of the feed's home page (this is NOT where the MP3s are! It is | ||
; just the link to your "about" page). | ||
|
@@ -101,7 +101,8 @@ | |
; See https://github.com/simplepie/simplepie-ng/wiki/Spec:-iTunes-Podcast-RSS | ||
; Valid values are "yes", "explicit", "true" or "no", "clean", "false" | ||
; | ||
; If you don't set this, it will not appear in the feed at all! | ||
; If you don't set this, it will not appear in the feed at all, and Apple | ||
; Podcasts may reject your feed! | ||
;ITUNES_EXPLICIT = "no" | ||
|
||
|
||
|
@@ -157,16 +158,39 @@ | |
; | ||
;ITUNES_SUBTITLE_SUFFIX = "" | ||
|
||
; Whether to output the <itunes:episode> and <itunes:season> tags | ||
; | ||
; Set the <itunes:type> tag. If you set this to "serial", it will | ||
; use the content of the ID3 "TRCK" and "TPOS" fields (also known as | ||
; "track number", and "part of a set" (or sometimes "disc number"), | ||
; respectively, as content of the <itunes:episode> and <itunes:season> tags. | ||
; | ||
; The TRCK and TPOS values should be non-zero positive integers (1, 2, 3, etc) | ||
; | ||
; NOTE: these are NOT used for ordering within the RSS feed. This is | ||
; still done by file date so it's up to you to make the episode order | ||
; and the file date order match by uploading them in season/episode order. | ||
; | ||
; The default value is "episodic", and no <itunes:episode> or <itunes:season> | ||
; tags will be output in the feed. | ||
; | ||
; If you don't want <itunes:type> to appear in the feed at all, set this to "" | ||
; | ||
; Any value that is not "" or "serial" will be treated as "episodic" | ||
;ITUNES_TYPE = "episodic" | ||
|
||
; *** CHECK THESE ARE OK. *** | ||
|
||
; Language of the feed | ||
; This defaults to en-us (US English). This must be something recognised by | ||
; the RSS standard. | ||
;LANGUAGE = en-us | ||
; the RSS standard. Apple Podcasts only supports values from the ISO 639 list | ||
; (two-letter language codes, with some possible modifiers, such as "en-us"). | ||
; See https://www.loc.gov/standards/iso639-2/php/code_list.php | ||
;LANGUAGE = "en-us" | ||
|
||
; Where to cache RSS feeds (this must be writable by the web server) | ||
; This defaults to a folder called 'temp' alongside the script | ||
;TMP_DIR = /tmp | ||
;TMP_DIR = "/tmp" | ||
|
||
; Number of items to show in the feed | ||
; This defaults to 10 | ||
|
@@ -228,8 +252,8 @@ | |
; generated, or from a file with the same name with .txt extension) then | ||
; set this parameter to 'summary'. Otherwise it will get its description from | ||
; comment tag embedded in the file. | ||
;DESCRIPTION_SOURCE=comment | ||
;DESCRIPTION_SOURCE = "comment" | ||
|
||
; If you want to have HTML in your <description> tag set this parameter. | ||
; Otherwise the content of the description will be escaped with htmlspecialchars() | ||
;DESCRIPTION_HTML= | ||
;DESCRIPTION_HTML = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class ITunesPodcastSeasonTest extends MixedMediaExampleTest | ||
{ | ||
public static function setUpBeforeClass(): void | ||
{ | ||
prepare_testing_dir(); | ||
|
||
copy('../fixtures/id3v1_artist_album_title.mp3', '1.mp3'); | ||
copy('../fixtures/id3v2_artist_album_title.mp3', '2.mp3'); | ||
copy('../fixtures/tagged.mp4', '3.mp4'); | ||
copy('../fixtures/id3v2_comment.mp3', '4.mp3'); | ||
copy('../fixtures/id3v2_artist_title_partofaset.mp3', '5.mp3'); | ||
copy('../fixtures/id3v2_artist_title_track.mp3', '6.mp3'); | ||
|
||
$now = time(); | ||
touch('1.mp3', $now); | ||
touch('2.mp3', $now+50); | ||
touch('3.mp4', $now+100); | ||
touch('4.mp3', $now+150); | ||
touch('5.mp3', $now+200); | ||
touch('6.mp3', $now+250); | ||
MixedMediaExampleTest::$filemtime = $now; | ||
|
||
file_put_contents('./dir2cast.ini', "ITUNES_TYPE = serial\n"); | ||
|
||
MixedMediaExampleTest::$output = ''; | ||
exec('php dir2cast.php --media-url=https://www.example.com/podcast/ --output=out.xml --min-file-age=0', MixedMediaExampleTest::$output, MixedMediaExampleTest::$returncode); | ||
} | ||
|
||
public function test_itunes_type() | ||
{ | ||
// generated valid XML | ||
$data = simplexml_load_string(file_get_contents(self::$file)); | ||
$itdtd = "http://www.itunes.com/dtds/podcast-1.0.dtd"; | ||
|
||
// assert itunes:type = serial | ||
$this->assertEquals('serial', $data->channel->children($itdtd)->type); | ||
} | ||
|
||
public function test_itunes_season() | ||
{ | ||
// generated valid XML | ||
$data = simplexml_load_string(file_get_contents(self::$file)); | ||
$itdtd = "http://www.itunes.com/dtds/podcast-1.0.dtd"; | ||
$this->assertEmpty($data->channel->item[0]->children($itdtd)->season); | ||
$this->assertEquals('Season 1', $data->channel->item[1]->children($itdtd)->season); | ||
$this->assertEmpty($data->channel->item[2]->children($itdtd)->season); | ||
$this->assertEmpty($data->channel->item[3]->children($itdtd)->season); | ||
$this->assertEmpty($data->channel->item[4]->children($itdtd)->season); | ||
$this->assertEmpty($data->channel->item[5]->children($itdtd)->season); | ||
} | ||
|
||
public function test_itunes_episode() | ||
{ | ||
// generated valid XML | ||
$data = simplexml_load_string(file_get_contents(self::$file)); | ||
$itdtd = "http://www.itunes.com/dtds/podcast-1.0.dtd"; | ||
$this->assertEquals('1', $data->channel->item[0]->children($itdtd)->episode); | ||
$this->assertEmpty($data->channel->item[1]->children($itdtd)->episode); | ||
$this->assertEmpty($data->channel->item[2]->children($itdtd)->episode); | ||
$this->assertEmpty($data->channel->item[3]->children($itdtd)->episode); | ||
$this->assertEmpty($data->channel->item[4]->children($itdtd)->episode); | ||
$this->assertEmpty($data->channel->item[5]->children($itdtd)->episode); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.