extractmagic stripping logic removes text #1

Closed
opened 4 years ago by decentral1se · 8 comments

Nice little tool! So, python palanggana.py --magic broadcastthingz gives '' and python palanggana.py --magic broadcastthingz --keep gives __BROADCASTTHINGZ__. Gonna try and get a patch in.

Nice little tool! So, `python palanggana.py --magic broadcastthingz` gives `''` and `python palanggana.py --magic broadcastthingz --keep` gives `__BROADCASTTHINGZ__`. Gonna try and get a patch in.
Poster

This patch seems to "fix it". But I guess the script was specifically for the case where magic words were appearing on each line? Well, do what you want with this :)

diff --git a/palanggana.py b/palanggana.py
index daaabd8..2f6b154 100644
--- a/palanggana.py
+++ b/palanggana.py
@@ -56,7 +56,7 @@ def extractmagic(plaintexts):
         if magicword in line:
             if not keep:
                 line = line.replace(magicword, "")
-            magiclines.append(line)
+        magiclines.append(line)
     return magiclines
This patch seems to "fix it". But I guess the script was specifically for the case where magic words were appearing on each line? Well, do what you want with this :) ```diff diff --git a/palanggana.py b/palanggana.py index daaabd8..2f6b154 100644 --- a/palanggana.py +++ b/palanggana.py @@ -56,7 +56,7 @@ def extractmagic(plaintexts): if magicword in line: if not keep: line = line.replace(magicword, "") - magiclines.append(line) + magiclines.append(line) return magiclines ```
Poster

However this change then doesn't strip out __PUBLISH__, e.g.

$ python palanggana.py --magic broadcast
__PUBLISH__

Poem 1 

I love enthusiasm  
So I am going to use the enthusiasm I got 
To praise a thing 
Called pirate radio 
If you know about pirate radio 
Come join me in a chorus of praise 
If you don't know about pirate radio 
Learn about it 
Then 
Come join me in a chorus of praise 

__PUBLISH__
Let's use free speech to praise pirate radio 
However this change then doesn't strip out `__PUBLISH__`, e.g. ``` $ python palanggana.py --magic broadcast __PUBLISH__ Poem 1 I love enthusiasm So I am going to use the enthusiasm I got To praise a thing Called pirate radio If you know about pirate radio Come join me in a chorus of praise If you don't know about pirate radio Learn about it Then Come join me in a chorus of praise __PUBLISH__ Let's use free speech to praise pirate radio ```
Poster
https://git.vvvvvvaria.org/decentral1se/Palanggana/commit/464d07a64fad6a0d3083aef24f685e0f08727bb8
Owner

@decentral1se I don't know if I can graps what the issue is here or not :)
but I kinda wrote it with the idea that users could publish individual lines.
thats why this has PUBLISH https://pad.vvvvvvaria.org/id3poetry on each line too.
but also for example grabbing AGREE from the minimal viable pad.

You don't necessarily want the entire pad.

In this way with NOTE you can grab all your notes(lines) across all published pads.

@decentral1se I don't know if I can graps what the issue is here or not :) but I kinda wrote it with the idea that users could publish individual lines. thats why this has __PUBLISH__ https://pad.vvvvvvaria.org/id3poetry on each line too. but also for example grabbing __AGREE__ from the minimal viable pad. You don't necessarily want the entire pad. In this way with __NOTE__ you can grab all your notes(lines) across all published pads.
Poster

Nice! Yeah, this makes sense. I guess if you want to add a --all or something like that for this case where all the text is the goal orrrrrr it is time to write another little script. Was nice to look at this code in any case.

Nice! Yeah, this makes sense. I guess if you want to add a `--all` or something like that for this case where all the text is the goal orrrrrr it is time to write another little script. Was nice to look at this code in any case.
Owner

merged into an issue to build two flags.
#2 here

merged into an issue to build two flags. https://git.vvvvvvaria.org/crunk/Palanggana/issues/2 here
crunk closed this issue 4 years ago
Owner

Merged into a issue/wish to have two extra arguments, here
#2

Merged into a issue/wish to have two extra arguments, here https://git.vvvvvvaria.org/crunk/Palanggana/issues/2
Owner
0740ba4789
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.