Skip to content

"/" is removed from performers and albumartists #227

@david-hill

Description

@david-hill

"Morton Feldman - Sabat / Clarke" becomes:
"Morton Feldman - Sabat Clarke"

$taglib = "d:\tools\taglib-sharp.dll"
[system.reflection.assembly]::loadfile($taglib)

function find_artist {
$=$args[0]
$media = [taglib.file]::create($
.FullName)
$tags = $media.GetTag('Id3v2')
$fileperformers = $tags.performers
$filealbumartists = $tags.albumartists
if (-not ( $fileperformers -eq $null) -and [string]::IsNullOrEmpty($fileperformers) -eq $False ) {
return $fileperformers
} elseif ( -not ( $filealbumartists -eq $null ) -and [string]::IsNullOrEmpty($filealbumartists) -eq $False ) {
return $filealbumartists
} else {
return $False
}
}

$basepath="D:\files"
$a = Get-ChildItem $basepath -recurse | Where-Object {$_.PSIsContainer -eq $True}

$a | Where-Object {$.GetFiles().Count -ne 0 -and $.GetDirectories().count -eq 0} | get-childitem | ForEach-Object {
if ( $.FullName -like '*mp3' -or $.FullName -like '*flac' -or $.FullName -like '*m4a' -or $.FullName -like '*wav') {
if (Test-Path -LiteralPath $.FullName) {
$artist=find_artist $

if (-not ( $artist -eq $False) ) {
if ( ( -not ( $artist -match "&") ) -and ( -not ( $artist -match "/" ) ) ) {
$dir=Split-Path -Path $_.FullName -Parent
if ( -not ( "$dir" -like "$basepath$artist*" ) -and -not ("$dir" -like "$basepath$artist") ) {
write-host "dir" $dir
write-host "$basepath$artist"
write-host $artist
if (-not(Test-Path -LiteralPath "$basepath$artist") ) {
New-Item -Path "$basepath" -Name "$artist" -ItemType "directory"
}
move-item -literalpath "$dir" -destination "$basepath$artist" -Force
}
} else {
write-host "$artist"
}
}
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions