Skip to content

Commit

Permalink
Added funding information 🤑
Browse files Browse the repository at this point in the history
Improved author information
Improved small parts of the code
Version update
  • Loading branch information
pr0pz committed Nov 23, 2022
1 parent e2f980d commit 4ac406d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
23 changes: 6 additions & 17 deletions ReleaseParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import patterns from './ReleasePatterns.js'
/**
* ReleaseParser - A tool for parsing scene release names.
*
* @author pr0pz
* @version 1.0.0
* @author Wellington Estevo
* @version 1.0.1
*
* @module ReleaseParser
* @param {string} releaseName - Original release name.
* @param {string} section - Optional: Original release section for even better parsing.
*/

const ReleaseParser = /** @lends module:ReleaseParser */ ( releaseName, section = '' ) => {

/**
Expand Down Expand Up @@ -607,12 +608,7 @@ const ReleaseParser = /** @lends module:ReleaseParser */ ( releaseName, section

// Description with date inside brackets is nearly always music or musicvideo
} else if ( releaseName.match( patterns.REGEX_DATE_MUSIC.toRegExp() ) ) {

if ( get( 'resolution' ) ) {
type = 'MusicVideo'
} else {
type = 'Music'
}
type = get( 'resolution' ) ? 'MusicVideo' : 'Music'

// Has date and a resolution? probably TV
} else if ( get( 'date' ) && get( 'resolution' ) ) {
Expand Down Expand Up @@ -1279,14 +1275,7 @@ const ReleaseParser = /** @lends module:ReleaseParser */ ( releaseName, section
break

case 'source':
// Check if we need to loop array
if ( Array.isArray( informationValue ) ) {
informationValue.forEach( ( source ) => {
attributes.push( patterns.SOURCE[ source ] )
} )
} else {
attributes.push( patterns.SOURCE[ informationValue ] )
}
attributes.push( patterns.SOURCE[ informationValue ] )
break

case 'version':
Expand Down Expand Up @@ -1509,7 +1498,7 @@ const ReleaseParser = /** @lends module:ReleaseParser */ ( releaseName, section
// Trim '-' at the end of the string
text = text.trim( '-' )
// Replace every separator char with whitespaces
text = text.replace( /[_\.]+/gi, ' ' )
text = text.replace( /[_.]+/gi, ' ' )
// Put extra whitespace between '-', looks better
//text = text.replace( '-', ' - ' )
// Trim and simplify multiple whitespaces
Expand Down
6 changes: 3 additions & 3 deletions ReleasePatterns.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* ReleasePatterns - All needed patterns for properly parsing releases.
*
* @author pr0pz
* @version 1.0.0
* @author Wellington Estevo
* @version 1.0.1
*/

// Reusable vars.
// Reusable vars
const regexDate = '(\\d{2}|\\d{4})[._-](\\d{2})[._-](\\d{2}|\\d{4})'
const regexTitle = '([\\w.()-]+?)' // last ? = JS fix for ungreedy
const regexEpisodeTv = '(?:(?:[ST]\\d+)?[._-]?(?:ep?|o[av]+[._-]?|d|eps[._-]?|episode[._-]?)[\\d-]+|\\d+x\\d+|[STD]\\d+)'
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "release-parser",
"version": "1.0.0",
"version": "1.0.1",
"description": "A tool for parsing scene release names.",
"main": "ReleaseParser.js",
"bin": "cli.js",
Expand All @@ -14,10 +14,25 @@
"warez",
"parser",
"release",
"predb"
"predb",
"propz"
],
"author": "pr0pz <[email protected]>",
"author": "Wellington Estevo <[email protected]> (https://propz.de)",
"license": "MIT",
"funding": [
{
"type": "ko-fi",
"url": "https://ko-fi.com/propz"
},
{
"type": "coindrop",
"url": "https://coindrop.to/propz"
}
],
"repository": {
"type": "git",
"url": "https://github.com/pr0pz/release-parser"
},
"bugs": {
"url": "https://github.com/pr0pz/release-parser/issues"
},
Expand Down
3 changes: 0 additions & 3 deletions test/ReleaseParser.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/**
* This is the main test file.
* This are hand selected, at some point 'more complex' releases that need to pass the test.
*
* @author pr0pz
* @version 1.0.0
*/

import ReleaseParser from '../ReleaseParser.js'
Expand Down

0 comments on commit 4ac406d

Please sign in to comment.