Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How to filter the output of write-to-file?
lame-name
post Jul 13 2008, 11:55 AM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 13-July 08
Member No.: 557



Hi, i am using the file integration to display my "now playing" info in some games (via the games 'exec file' function). Works like charm, BUT i'd like to filter certain words from the output.

For example some webradios put "WWW.SOME-NAME.STUFF" into the song information. Since that can be a very long text (if in title AND album, for example), i'd like to automatically remove that (or if possible: replace with custom text).

I've been playing around with the reg. expressions of the "Ignore song titles matching pattern" feature, but it looks like it COMPLETELY ignores the songinfo if it matches to the regex. (either that, or i somehow missed something)

Thanks for any help or hint.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
xaxaman
post Jul 15 2008, 09:47 AM
Post #2


Newbie
*

Group: Members
Posts: 2
Joined: 18-June 08
Member No.: 540



QUOTE(lame-name @ Jul 13 2008, 11:55 AM) *

Hi, i am using the file integration to display my "now playing" info in some games (via the games 'exec file' function). Works like charm, BUT i'd like to filter certain words from the output.

For example some webradios put "WWW.SOME-NAME.STUFF" into the song information. Since that can be a very long text (if in title AND album, for example), i'd like to automatically remove that (or if possible: replace with custom text).

I've been playing around with the reg. expressions of the "Ignore song titles matching pattern" feature, but it looks like it COMPLETELY ignores the songinfo if it matches to the regex. (either that, or i somehow missed something)

Thanks for any help or hint.


Yo dude, can i ask in which games it works? Because in my games it does not, i haf found a topic and also gave several hints how to solve this problem, maybe i need send Serge a PM or something.
Whatever, your feature would work if you hear a specific Internet radio all the time, but if u change stations the webadresses and the radio text also changes. Maybe its hard to solve..
Let's see what the master says.. ;]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
lame-name
post Jul 15 2008, 03:57 PM
Post #3


Newbie
*

Group: Members
Posts: 4
Joined: 13-July 08
Member No.: 557



QUOTE(xaxaman @ Jul 15 2008, 11:47 AM) *

Yo dude, can i ask in which games it works? Because in my games it does not, i haf found a topic and also gave several hints how to solve this problem, maybe i need send Serge a PM or something.


I use it in Counterstrike and other HL-based games. It should work in any game that has a console or at least lets you execute custom config files.

I've set the file location in AMIP Configurator to:
CODE
X:\Steam\steamapps\MYACCOUNT\counter-strike\cstrike\nowplaying.rc

(This writes the songinfo to a standard textfile with a .rc-ending to the game directory. I guess you could use .cfg or whatever you prefer instead of .rc).

The songinfo alone wouldn't do anything ingame though, therefore the text it writes to the textfiles has to include the command that your game uses to display info. An example for CS:
CODE
say_team "np: %name"

The above would write something like this to the nowplaying.rc:
CODE
say_team "np: Artist - Title"


Now if you bind a key to "exec nowplaying.rc" it executes the content of the file. In this case it would send your songinfo as a message in teamchat after pressing whatever key you used to bind. Of course you can use more complex stuff with all the other variables or counterstrike specific color codes etc

This is how it looks ingame
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
lame-name
post Jul 17 2008, 03:59 PM
Post #4


Newbie
*

Group: Members
Posts: 4
Joined: 13-July 08
Member No.: 557



So, is it not possible to pre-filter the AMIP output or is it just so easy and obvious that no one wants to point it out? I mean a simple answer like one of the following would be appreciated:

- "it is not possible, and it's never gonna happen",
- "not possible atm, but planned",
- "yes it works, just RTFM more closely", or
- "possible, with some exotic workaround: hint" ...

Any reaction is better than no reaction at all.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Serge
post Jul 17 2008, 06:30 PM
Post #5


AMIP Developer
***

Group: Root Admin
Posts: 935
Joined: 12-March 06
Member No.: 1



http://amip.tools-for.net/wiki/manual/amip#formatting

$strip(pattern,subject)
Removes all matches to pattern from subject

$strrep(search,replace,subject)
Returns a string with all occurrences of search in subject replaced with the given replace value

$regrep(pattern,replacement,subject)
Searches subject for matches to pattern and replaces them with replacement
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
lame-name
post Jul 18 2008, 09:40 AM
Post #6


Newbie
*

Group: Members
Posts: 4
Joined: 13-July 08
Member No.: 557



Ah! I didn't read that part carefully at first (it's kinda small^^). Thank you very much!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: