1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-22 20:41:26 +00:00

Add xmms-imms 1.0. IMMS is an XMMS plugin which replaces the standard

shuffle function with a smarter, weighted shuffle function based on
how often you play/skip files and their sound contents.

Development Status: 4 - Beta
This commit is contained in:
Brian Feldman 2004-02-12 01:42:22 +00:00
parent 9950dbb3ae
commit 9a9e76725a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=100734
13 changed files with 235 additions and 0 deletions

View File

@ -393,6 +393,7 @@
SUBDIR += xmms-faad
SUBDIR += xmms-fc
SUBDIR += xmms-flac
SUBDIR += xmms-imms
SUBDIR += xmms-infopipe
SUBDIR += xmms-kde
SUBDIR += xmms-kj

35
audio/xmms-imms/Makefile Normal file
View File

@ -0,0 +1,35 @@
# New ports collection makefile for: xmms-imms
# Date created: Wed Feb 11 17:11:37 EST 2004
# Whom: Brian Feldman <green@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= imms
PORTVERSION= 1.0
CATEGORIES= audio
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
PKGNAMEPREFIX= xmms-
MAINTAINER= green@FreeBSD.org
COMMENT= Automatic, weight-based playlist ordering plugin for XMMS
LIB_DEPENDS= xmms.4:${PORTSDIR}/multimedia/xmms \
sqlite.2:${PORTSDIR}/databases/sqlite \
pcre.0:${PORTSDIR}/devel/pcre \
id3:${PORTSDIR}/audio/id3lib \
vorbis.2:${PORTSDIR}/audio/libvorbis
USE_BZIP2= yes
USE_X_PREFIX= yes
USE_GNOME= gtk12
USE_GMAKE= yes
USE_AUTOCONF= yes
USE_AUTOHEADER= yes
WANT_AUTOCONF_VER= 257
GNU_CONFIGURE= yes
CONFIGURE_ENV= LIBS="-L${LOCALBASE}/lib" CFLAGS="-I${LOCALBASE}/include"
INSTALLS_SHLIB= yes
.include <bsd.port.mk>

1
audio/xmms-imms/distinfo Normal file
View File

@ -0,0 +1 @@
MD5 (imms-1.0.tar.bz2) = 32b46ac3ae1775a8a5e09273664b5f25

View File

@ -0,0 +1,17 @@
--- fetcher.cc.orig Sun Jan 25 16:55:21 2004
+++ fetcher.cc Wed Feb 11 18:34:39 2004
@@ -200,8 +200,12 @@
return identified;
// Erase the first occurrence of the artist
- list<string>::iterator i = find(file_parts.begin(), file_parts.end(),
- artist);
+ list<string>::iterator i = file_parts.begin();
+ while (i != file_parts.end()) {
+ if (*i == artist)
+ break;
+ i++;
+ }
if (i != file_parts.end())
file_parts.erase(i);

View File

@ -0,0 +1,34 @@
--- imms.cc.orig Wed Feb 11 17:47:21 2004
+++ imms.cc Wed Feb 11 18:03:41 2004
@@ -1,7 +1,6 @@
#include <time.h>
#include <ctype.h>
#include <math.h>
-#include <stdlib.h> // for (s)random
#include <iostream>
#include <iomanip>
@@ -43,23 +42,6 @@
//////////////////////////////////////////////
string last_song;
-
-// Random
-int imms_random(int max)
-{
- int rand_num;
- static struct random_data rand_data;
- static char rand_state[256];
- static bool initialized = false;
- if (!initialized)
- {
- initstate_r(time(0), rand_state, sizeof(rand_state), &rand_data);
- initialized = true;
- }
- random_r(&rand_data, &rand_num);
- double cof = rand_num / (RAND_MAX + 1.0);
- return (int)(max * cof);
-}
// Imms
Imms::Imms()

View File

@ -0,0 +1,24 @@
--- picker.cc.orig Sun Jan 25 16:55:21 2004
+++ picker.cc Wed Feb 11 18:47:20 2004
@@ -1,4 +1,5 @@
#include <iostream>
+#include <math.h>
#include "picker.h"
#include "strmanip.h"
@@ -31,9 +32,12 @@
SongData data(position, path);
- if (find(candidates.begin(), candidates.end(), data)
- != candidates.end())
- return true;
+ Candidates::iterator i = candidates.begin();
+ while (i != candidates.end()) {
+ if (*i == data)
+ return true;
+ i++;
+ }
int cost = fetch_song_info(data);

View File

@ -0,0 +1,55 @@
--- plugin.cc.orig Sun Jan 25 16:55:21 2004
+++ plugin.cc Wed Feb 11 18:51:51 2004
@@ -5,6 +5,9 @@
#include <string>
#include <iostream>
#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <limits.h>
#include <xmms/plugin.h>
#include <xmms/xmmsctrl.h>
@@ -21,6 +24,7 @@
// Local vars
static Imms *imms = NULL;
+static int urandom = -1;
unsigned int time_left = 1000, sloppy_skips = 0;
int last_plpos = -2, cur_plpos, pl_length = -1;
int good_length = 0, song_length = 0, delay = 0;
@@ -39,6 +43,15 @@
FIND_NEXT = 2
} state;
+// Random
+int imms_random(int max)
+{
+ unsigned long rand_num;
+ (void)read(urandom, &rand_num, sizeof(rand_num));
+ double cof = rand_num / (ULONG_MAX + 1.0);
+ return (int)(max * cof);
+}
+
// Wrapper that frees memory
string imms_get_playlist_item(int at)
{
@@ -62,14 +75,17 @@
void imms_init()
{
- if (!imms)
+ if (!imms) {
imms = new Imms();
+ urandom = open("/dev/urandom", O_RDONLY);
+ }
state = IDLE;
}
void imms_cleanup(void)
{
+ close(urandom);
delete imms;
imms = 0;
}

View File

@ -0,0 +1,14 @@
--- plugin.h.orig Wed Feb 11 17:44:30 2004
+++ plugin.h Wed Feb 11 17:45:06 2004
@@ -1,7 +1,11 @@
#ifndef __PLUGIN_H
#define __PLUGIN_H
+#if HAVE_STDINT_H
#include <stdint.h>
+#else
+#include <sys/types.h>
+#endif
#ifdef __cplusplus
extern "C" {

View File

@ -0,0 +1,11 @@
--- rules.mk.orig Sun Jan 25 16:55:21 2004
+++ rules.mk Wed Feb 11 18:43:22 2004
@@ -57,7 +57,7 @@
$(warning Use 'make install-user' to install for the current user only.)
install-system: libimms.so
- ${INSTALL_PROGRAM} libimms.so ${DESTDIR}`xmms-config --visualization-plugin-dir`
+ ${INSTALL_PROGRAM} libimms.so `xmms-config --visualization-plugin-dir`
user-message:
$(warning Defaulting to installing for current user only.)

View File

@ -0,0 +1,14 @@
--- spectrum.h.orig Sun Jan 25 16:55:21 2004
+++ spectrum.h Wed Feb 11 17:45:20 2004
@@ -1,7 +1,11 @@
#ifndef __SPECTRUM_H
#define __SPECTRUM_H
+#if HAVE_STDINT_H
#include <stdint.h>
+#else
+#include <sys/types.h>
+#endif
#include <time.h>
#include <sys/time.h>

View File

@ -0,0 +1,19 @@
--- vars.mk.in.orig Sun Jan 25 16:55:21 2004
+++ vars.mk.in Wed Feb 11 18:40:43 2004
@@ -4,14 +4,13 @@
INSTALL_PROGRAM = @INSTALL@
DESTDIR = @prefix@
-SHELL = bash
XMMS_OBJ = plugin.o interface.o libimmscore.a
CORE_OBJ = imms.o immsdb.o fetcher.o picker.o spectrum.o sqldb.o \
songinfo.o regexx.o strmanip.o levenshtein.o xidle.o md5.o
-CFLAGS = `xmms-config --cflags` @DEBUG_CFLAGS@ -Wall -fPIC -D_REENTRANT
+CFLAGS = `xmms-config --cflags` @CFLAGS@ -Wall -fPIC -D_REENTRANT
CPPFLAGS = ${CFLAGS} -pedantic -fno-rtti
-LDFLAGS = `xmms-config --libs` @LIBS@
+LDFLAGS = `xmms-config --libs` -lc @LIBS@
ARFLAGS = rs
default: all

View File

@ -0,0 +1,9 @@
IMMS is an intelligent playlist plug-in for XMMS that tracks your
listening patterns and dynamically adapts to your taste. It is
incredibly unobtrusive and easy to use as it requires no direct user
interaction.
WWW: http://www.luminal.org/wiki/index.php/IMMS/IMMS
Author: Michael Grigoriev <mag@luminal.org>
- Brian Feldman <green@FreeBSD.org>

View File

@ -0,0 +1 @@
lib/xmms/Visualization/libimms.so