Skip to content

Commit

Permalink
Merge pull request #8 from silv3rr/flac
Browse files Browse the repository at this point in the history
add mod_flac
  • Loading branch information
silv3rr authored Jul 23, 2024
2 parents f8fa619 + 65e41ee commit 13dbfb3
Show file tree
Hide file tree
Showing 17 changed files with 672 additions and 98 deletions.
63 changes: 44 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,49 @@ on:

jobs:
build:
name: Compile foo-tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: configure
working-directory: ./src
run: ./configure
- name: make build (all)
working-directory: ./src
run: make build
- name: make foobnc
working-directory: ./src/bouncer
run: make
- name: make webspy
working-directory: ./src/who
run: make webspy
- name: make foopre modules
working-directory: ./src/pre/modules
run: sudo apt-get install -qy libncurses-dev libflac-dev && make && size *.so
- name: make show
working-directory: ./src
run: make show
- uses: actions/checkout@v4
- name: configure
working-directory: ./src
run: ./configure
- name: make build (all)
working-directory: ./src
run: make build
- name: make foobnc
working-directory: ./src/bouncer
run: make
- name: make webspy
working-directory: ./src/who
run: make webspy
- name: make foopre modules
working-directory: ./src/pre/modules
run: sudo apt-get install -qy libncurses-dev libflac-dev && make && size *.so
- name: make show
working-directory: ./src
run: make show

release:
name: Create Release
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: foo-tools
body: |
Includes foo-pre, mp3genre and modules
See [CHANGES](src/CHANGES)
draft: false
prerelease: false
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ entry
datanode
*.pid
nfocleaner
foobnc
foo-nukes
foo-pre
mp3info
Expand All @@ -45,6 +46,9 @@ config.log
autom4te.cache/
*.swp

.vscode/
test/
tmp/
*.bak
*.log
*.debug
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ This software comes without any claims regarding security or support about how t
This is a modified and updated version of foo-tools by Tanesha Team:

- modification to foo-pre; shows mp3 genre in PRE line (no module needed)
- added modules: mod_audiosort, mod_prebw, mod_flac
- added date/time in foo-pre.log
- added mod_audiosort, mod_prebw
- updated Makefiles, fixed compiler warnings
- updates/fixes from upstream [glftpd/foo-tools](https://github.com/glftpd/foo-tools)
- includes updates/fixes from upstream [glftpd/foo-tools](https://github.com/glftpd/foo-tools)

For more details see [CHANGELOG](src/CHANGES).

Expand All @@ -34,26 +34,32 @@ The original foo-tools version by Tanesha is available from this branch: [foo-or

It does include fixes, but not the mp3genre modification.

There's also [foo-2007](https://github.com/silv3rr/foo-tools/tree/foo-2007) which is 3.1 version by Hujer.

## Documentation

### Installation

Quick start:

1) First get this repo with `git clone`
2) Build all tools: `cd src && ./configure && make build`
3) See README for specific tool in [doc](doc) dir

### Detailed instructions ###
### Detailed instructions

- [README.1st](README.1st) Original README file
- [src/README.1st](src/README.1st) Building instructions
- [src/README.1st](src/README.1st) Building
- [doc/HOWTO](doc/HOWTO) Notes about compiling
- [doc/README.foo-pre](doc/README.foo-pre) foo-pre
- [doc](doc) Documentation on installing/running the programs

### Modules

Addons for foo-pre; modules add functions but are not build into foo-pre binary

- [src/pre/README.modules](src/pre/README.modules)
- [src/pre/modules/README.mod_flac](src/pre/modules/README.mod_flac)
- [src/pre/modules/README.mod_prebw](src/pre/modules/README.mod_prebw)
- [src/pre/modules/README.mod_audiosort](src/pre/modules/README.mod_audiosort)
- [src/pre/modules/README.mod_chmod](src/pre/modules/README.mod_chmod)
Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Things that ~~might eventually~~ never get done.. or not :)
## foo-pre

- [ ] replace pre/mp3genre by pzs-ng code or other id3 lib instead (PR welcome)
- [ ] add FLAC support (unlikely but PR's welcome)
- [x] add FLAC support (unlikely but PR's welcome)
- [x] add module: prebw after pre (mod_prebw)

7 changes: 7 additions & 0 deletions src/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Sep 28 2004: * Added WOY to the SECTION dir as a macro for Week of Year.

Cheers, Tanesha Team <[email protected]>.

--------------------

//PCFiL
Jul 27 2011: * Fixed dirlog damage on x64 OS for foo-pre
* Fixed foo-spy (spy) with new glftpd headers. (remember to set key in who.cfg)
Expand Down Expand Up @@ -110,3 +112,8 @@ Mar 03 2022: + added mod_prebw

Jun 28 2023: * changed date macros for 'dir' property to %MM %DD etc
* changed prebw module to run bin without any output

Feb 29 2024: + added flac module, thanks to an anonymous 'donor'
Mar 02 2024: * cleaned up mod_flac a bit and added artist/album tags, vendor_string
Mar 03 2024: * fixed module tester

23 changes: 11 additions & 12 deletions src/pre/modules/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ SRCDIR = ../..

LIBS = $(SRCDIR)/lib/macro.o $(SRCDIR)/lib/gllogs.o $(SRCDIR)/lib/pwdfile.o $(SRCDIR)/util/linefilereader.o $(SRCDIR)/collection/hashtable.o $(SRCDIR)/lib/stringtokenizer.o

all: mod_idmp3.so mod_sitenfoadd.so mod_nfohandler.so mod_chmod.so mod_symlink.so mod_audiosort.so mod_prebw.so
all: mod_idmp3.so mod_sitenfoadd.so mod_nfohandler.so mod_chmod.so mod_symlink.so mod_audiosort.so mod_prebw.so mod_flac.so

mod_prebw_debug.so: CC += -DDEBUG
mod_audiosort_debug.so: CC += -DDEBUG
mod_flac_debug.so: CC += -DDEBUG

mod_idmp3.so: mod_idmp3.o
(cd mp3info; make)
Expand All @@ -24,19 +28,14 @@ mod_nfohandler.so: mod_nfohandler.o
mod_symlink.so: mod_symlink.o
$(CC) -g -shared -Wl,-soname,mod_symlink.so -o $@ $< $(LIBS)

mod_audiosort.so: mod_audiosort.o
$(CC) $(CFLAGS) -shared -Wl,-soname,mod_audiosort.so -o $@ $< $(LIBS) $(SRCDIR)/collection/strlist.o

mod_prebw.so: mod_prebw.o
$(CC) $(CFLAGS) -shared -Wl,-soname,mod_prebw.so -o $@ $< $(LIBS) $(SRCDIR)/collection/strlist.o
mod_audiosort.so mod_audiosort_debug.so: mod_audiosort.o
$(CC) $(CFLAGS) -g -shared -Wl,-soname,mod_audiosort.so -o $@ $< $(LIBS) $(SRCDIR)/collection/strlist.o

mod_audiosort_debug.so:
$(CC) -g -DDEBUG -c mod_audiosort.c -I${SRCDIR}
$(CC) -g -shared -Wl,-soname,mod_audiosort.so -o $@ mod_audiosort.o $(LIBS) $(SRCDIR)/collection/strlist.o
mod_prebw.so mod_prebw_debug.so: mod_prebw.o
$(CC) $(CFLAGS) -g -shared -Wl,-soname,mod_prebw.so -o $@ $< $(LIBS) $(SRCDIR)/collection/strlist.o

mod_prebw_debug.so:
$(CC) -g -DDEBUG -c mod_prebw.c -I${SRCDIR}
$(CC) -g -shared -Wl,-soname,mod_prebw.so -o $@ mod_prebw.o $(LIBS) $(SRCDIR)/collection/strlist.o
mod_flac.so mod_flac_debug.so: mod_flac.o
$(CC) $(CFLAGS) -g -shared -Wl,-soname,mod_flac.so -o $@ $< $(LIBS) -lFLAC

tester: tester.o
$(CC) -g -o $@ $< ../../collection/hashtable.o ../../util/linefilereader.o $(SRCDIR)/lib/gllogs.o -ldl
Expand Down
1 change: 1 addition & 0 deletions src/pre/modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Addons for foo-pre; modules add functions but are not build into foo-pre binary

[README.modules](../README.modules)

- [README.mod_flac](README.mod_flac)
- [README.mod_prebw](README.mod_prebw)
- [README.mod_audiosort](README.mod_audiosort)
- [README.mod_chmod](README.mod_chmod)
Expand Down
62 changes: 62 additions & 0 deletions src/pre/modules/README.mod_flac
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
FLACINFO

Building:
---------
mod_flac depends on the libflac package (libflac-dev)

Run 'make' in this dir to build mod_flac.so
Copy it to /glftpd/bin/premodules and make sure libflac.so is in glftpd's lib dir

Add it to the modules list in pre.cfg like this:

modules=/bin/premodules/mod_flac.so

If you have more modules already loaded, it will look like this

modules=/bin/premodules/mod_other.so|/bin/premodules/mod_whatever.so|/bin/premodules/mod_flac.so


Output:
-------

output from mod_flac can be configured using the setting:

mod_flac.output=output string

in pre.cfg, default output string is:

PRE-FLACINFO: "%R" "%a" "%l" "%y" "%g" "" "%r" "%Q" "%o" "" "" "" "" "%v"

The variables are similar to mp3:

%R - release name, eg. Me_and_Myself-My_Leet_Tracks-FLAC-2013-Whatever
%a - artist
%l - album name
%y - year
%g - genre (string)
%G - UNUSED
%r - bitrate in Kbit/s
%Q - sampling frequency in Hz
%o - channelmode
%m - UNUSED
%s - UNUSED
%S - UNUSED
%L - UNUSED
%v - vendor version string


Sitebot:
--------

pzs-ng's ngBot.conf:

set redirect(PRE-FLACINFO) $mainchan
set disable(PRE-FLACINFO) 0
set chanlist(PRE-FLACINFO) $mainchan
set variables(PRE-FLACINFO) "%releasename %artist %album %year %genre %none %bitrate %sampling %mode %none %none %none %none %version"
lappend msgtypes(DEFAULT) "PRE-FLACINFO"

add to theme:

announce.PRE-FLACINFO = "[%b{%c1{pre-flacinfo}}] %artist - %album :: %b{%genre} from %year at %b{%sampling}Hz in %b{%mode} channels %b{%bitrate}kbps (%version)"

21 changes: 19 additions & 2 deletions src/pre/modules/README.mod_idmp3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

MP3INFO

Building:
---------
Expand Down Expand Up @@ -40,7 +40,7 @@ output from mod_idmp3 can be configured using the setting:

mod_idmp3.output=output string

in the pre.cfg, default output string is:
in pre.cfg, default output string is:

PRE-MP3INFO: "%R" "%a" "%l" "%y" "%g" "%G" "%r" "%Q" "%o" "%m" "%s" "%S" "%L"

Expand All @@ -62,3 +62,20 @@ if you know that program, you should be familiar with this too.
%L - mpeg layer

NYI = not yet implemented.


Sitebot:
--------

pzs-ng's ngBot.conf:

set redirect(PRE-MP3INFO) $mainchan
set disable(PRE-MP3INFO) 0
set chanlist(PRE-MP3INFO) $mainchan
set variables(PRE-MP3INFO) "%releasename %artist %album %year %genre %genre_id %bitrate %sampling %mode %none %none %none %mpeglayer"
lappend msgtypes(DEFAULT) "PRE-MP3INFO"

default theme:

announce.PRE-MP3INFO = "[%b{%c1{pre-mp3info}}] %artist - %album :: %b{%genre}(genre_id) from %year at %b{%sampling}Hz in %b{%mode} %b{%bitrate}kbps (%mpeglayer)"

Loading

0 comments on commit 13dbfb3

Please sign in to comment.