mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
T357: Remove the dot at the end of a filename when generating a missing title tag, and allow the importer to process tracks shorter than 30 seconds.
This commit is contained in:
parent
9cb13ee535
commit
4b5547b10c
2 changed files with 7 additions and 5 deletions
|
@ -192,7 +192,7 @@ class ImportMLPMA extends Command {
|
|||
// Fill in the title tag if it's missing.
|
||||
//==========================================================================================================
|
||||
if (!$parsedTags['title']) {
|
||||
$parsedTags['title'] = $file->getBasename($file->getExtension());
|
||||
$parsedTags['title'] = $file->getBasename('.'.$file->getExtension());
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,7 +323,7 @@ class ImportMLPMA extends Command {
|
|||
$trackFile = new UploadedFile($file->getPathname(), $file->getFilename(), $allTags['mime_type']);
|
||||
Input::instance()->files->add(['track' => $trackFile]);
|
||||
|
||||
$upload = new UploadTrackCommand(true);
|
||||
$upload = new UploadTrackCommand(true, true);
|
||||
$result = $upload->execute();
|
||||
|
||||
if ($result->didFail()) {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
class UploadTrackCommand extends CommandBase {
|
||||
private $_allowLossy;
|
||||
private $_allowShortTrack;
|
||||
private $_losslessFormats = [
|
||||
'flac',
|
||||
'pcm_s16le ([1][0][0][0] / 0x0001)',
|
||||
|
@ -22,8 +23,9 @@
|
|||
'pcm_f32be (fl32 / 0x32336C66)'
|
||||
];
|
||||
|
||||
public function __construct($allowLossy = false) {
|
||||
public function __construct($allowLossy = false, $allowShortTrack = false) {
|
||||
$this->_allowLossy = $allowLossy;
|
||||
$this->_allowShortTrack = $allowShortTrack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,9 +48,9 @@
|
|||
'track' =>
|
||||
'required|'
|
||||
. ($this->_allowLossy ? '' : 'audio_format:'. implode(',', $this->_losslessFormats).'|')
|
||||
. ($this->_allowShortTrack ? '' : 'min_duration:30|')
|
||||
. 'audio_channels:1,2|'
|
||||
. 'sample_rate:44100,48000,88200,96000,176400,192000|'
|
||||
. 'min_duration:30'
|
||||
. 'sample_rate:44100,48000,88200,96000,176400,192000'
|
||||
]);
|
||||
|
||||
if ($validator->fails())
|
||||
|
|
Loading…
Reference in a new issue