Open-source News

UEFI 2.10 + ACPI 6.5 Specifications Released With Updates For CXL, LoongArch, RISC-V

Phoronix - Tue, 08/30/2022 - 00:19
The UEFI Forum has published the UEFI 2.10 and ACPI 6.5 specifications to make these standards more adaptable to IoT platforms and other new device support from the LoongArch processor architecture to CXL memory support...

Intel Sends In More GPU Driver Patches For Linux 6.1: More Arc Graphics, Early MTL

Phoronix - Mon, 08/29/2022 - 22:53
Following last week's initial batch of Intel i915 GT updates for DRM-Next ahead of Linux 6.1, today a new pull request was issued of drm-intel-next material that is primed for Linux 6.1...

PostgreSQL Optimizes Performance & Lower Memory Management Overhead

Phoronix - Mon, 08/29/2022 - 19:40
An interesting commit made it into the open-source PostgreSQL database server this morning...

Intel Revises Linux Graphics Driver Support For DP MST Display Stream Compression

Phoronix - Mon, 08/29/2022 - 19:12
Along with all the other ongoing Linux work for Arc Graphics, another feature patch series from Intel worth mentioning is they have been buttoning up work on DisplayPort Multi-Stream Transport Display Stream Compression (MST DSC) functionality...

AMD Posts Latest VNMI Patches For The Linux Kernel

Phoronix - Mon, 08/29/2022 - 18:57
Back in early June AMD engineers began posting support for enabling Virtual NMI on Linux for AMD CPUs with KVM and permitting hardware support. VNMI is expected to finally happen on the AMD side with Zen 4 processors and today they posted their latest revision of this work...

Latest Round Of Optimizations Wrap Up For Old ATI R300 To R500 GPUs On Linux

Phoronix - Mon, 08/29/2022 - 18:38
Last week I wrote about Mesa's R300 Gallium3D driver seeing new optimizations for R300~R500 class GPUs from the ATI days, thanks to the open-source community. Another merge request is now open that finishes up the latest optimization spree for these old pre-AMD GPUs on Linux...

ASpeed DRM Driver Adding DMA-BUF/PRIME Sharing For Use With Servers Having dGPUs

Phoronix - Mon, 08/29/2022 - 18:23
The ASpeed "AST" DRM driver that is for use with ASpeed BMCs on server platforms for display capabilities is preparing to see DMA-BUF and PRIME sharing support. This is useful so the ASpeed BMC can see the screen contents even if the server is relying on a discrete GPU rather than the baseboard management controller's monitor output...

Clean up unwanted files in your music directory using Groovy

opensource.com - Mon, 08/29/2022 - 15:00
Clean up unwanted files in your music directory using Groovy Chris Hermansen Mon, 08/29/2022 - 03:00 Register or Login to like Register or Login to like

In this series, I'm developing several scripts to help in cleaning up my music collection. In the last article, we used the framework created for analyzing the directory and sub-directories of music files, checking to make sure each album has a cover.jpg file and recording any other files that aren't FLAC, MP3, or OGG.

I uncovered a few files that can obviously be deleted—I see the odd foo lying around—and a bunch of PDFs, PNGs, and JPGs that are album art. With that in mind, and thinking about the cruft removal task, I offer an improved script that uses a Groovy map to record file names and counts of their occurrences and print that in CSV format.

More on Java What is enterprise Java programming? Red Hat build of OpenJDK Java cheat sheet Free online course: Developing cloud-native applications with microservices Fresh Java articles Get started analyzing with Groovy

If you haven't already, read the first three articles of this series before continuing:

They'll ensure you understand the intended structure of my music directory, the framework created in that article, and how to pick up FLAC, MP3, and OGG files. In this article, I facilitate removing unwanted files in the album directories.

The framework and the album files analysis bits

Start with the code. As before, I've incorporated comments in the script that reflect the (relatively abbreviated) "comment notes" that I typically leave for myself:

1        // Define the music libary directory
2        // def musicLibraryDirName = '/var/lib/mpd/music'
3        // Define the file name accumulation map
4        def fileNameCounts = [:]
5        // Print the CSV file header
6        println "filename|count"
7        // Iterate over each directory in the music libary directory
8        // These are assumed to be artist directories
9        new File(musicLibraryDirName).eachDir { artistDir ->
10            // Iterate over each directory in the artist directory
11            // These are assumed to be album directories
12            artistDir.eachDir { albumDir ->
13                // Iterate over each file in the album directory
14                // These are assumed to be content or related
15                // (cover.jpg, PDFs with liner notes etc)
16                albumDir.eachFile { contentFile ->
17                    // Analyze the file
18                    if (contentFile.name ==~ /.*\.(flac|mp3|ogg)/) {
19                        // nothing to do here
20                    } else if (contentFile.name == 'cover.jpg') {
21                        // don't need to do anything with cover.jpg
22                    } else {
23                        def fn = contentFile.name
24                        if (contentFile.isDirectory())
25                            fn += '/'
26                        fileNameCounts[fn] = fileNameCounts.containsKey(fn) ?  fileNameCounts[fn] + 1 : 1
27                    }
28                }
29            }
30        }
31        // Print the file name counts
32        fileNameCounts.each { key, value ->
33            println "$key|$value"
34        }

This is a pretty straightforward set of modifications to the original framework.

Lines 3-4 define fileNameCount, a map for recording file name counts.

Lines 17-27 analyze the file names. I avoid any files ending in .flac, .mp3 or .ogg as well as cover.jpg files.

Lines 23-26 record file names (as keys to fileNameCounts) and counts (as values). If the file is actually a directory, I append a / to help deal with it in the removal process. Note in line 26 that Groovy maps, like Java maps, need to be checked for the presence of the key before incrementing the value, unlike for example the awk programming language.

That's it!

I run this as follows:

$ groovy TagAnalyzer4.groovy > tagAnalysis4.csv

Then I load the resulting CSV into a LibreOffice spreadsheet by navigating to the Sheet menu and selecting Insert sheet from file. I set the delimiter character to &$124;.

Image by:

(Chris Hermansen, CC BY-SA 4.0)

I've sorted this in decreasing order of the column count to emphasize repeat offenders. Note as well on lines 17-20 a bunch of M3U files that refer to the name of the album, probably created by some well-intentioned ripping program. I also see, further down (not shown), files like fix and fixtags.sh, evidence of prior efforts to clean up some problem and leaving other cruft lying around in the process. I use the find command line utility to get rid of some of these files, along the lines of:

$ find . \( -name \*.m3u -o -name tags.txt -o -name foo -o -name .DS_Store \
-o -name fix -o -name fixtags.sh \) -exec rm {} \;

I suppose I could have used another Groovy script to do that as well. Maybe next time.

In this demonstration, I facilitate removing unwanted files in the album directories.

Image by:

Opensource.com

Java Audio and music What to read next How I analyze my music directory with Groovy My favorite open source library for analyzing music files How I use Groovy to analyze album art in my music directory This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Pages