"ASFUnicodeAttribute" problem when printing wma song titles with mutagen - mutagen

Hey guys I recently started working with mutagen and I'm facing a very annoying problem.
Let´s say I´m trying to print the title of a wma file with mutagen:
from mutagen.asf import ASF
song=r"C:\Users\j2the\Music\The One and Only\Rammstein\Made In Germany\03 Keine Lust.wma"
song_wma=ASF(song)
print(song_wma["Title"])
The code may work fine, but when printing the title of the wma file, python always adds the extension [ASFUnicodeAttribute...] to the actual filename:
[ASFUnicodeAttribute('Keine Lust')]
Is there any way to have the code return only the actual title of the song?
Thanks in advance for your help!

Ok I eventually figured out the solution myself. It's actually very simple. All you have to do is iterate over the title tag and voilà: You´re left with only the title of the song:
for e in song_wma["Title"]:
print(e)
Outcome:
Keine Lust

And by the way, if anybody is loooking for an easy tagging module for mp3, wma, flac files etc., I would recommend the tinytag module, which is much less complicated to work with than the mutagen module. Just my personal opinion though.

Related

RE: Mail Merge Google Sheet - Default subject line & Time trigger

Thanks in advance for your assistance here. I really appreciate it!!
I have built a script using the template here: https://developers.google.com/workspace/solutions/mail-merge
...And it's awesome. Working perfectly and solving a big problem for me!!
I have 2 problems I need to fix, and I need your help, please!!
Problem 1: Can I use a column (or cell reference) as a default "subjectLine" rather than it be user input each time the script is run?
Problem 2: Once Problem 1 (above) is solved, I'd like to trigger the script to automatically run every 15 minutes, continuously.
Any tips/scripts/pointers would be awesome. I am quite new to coding so have tried to dig up how to replace the user input piece of code with a default value for the subject line, but I can't figure it out. And only once this is done, can I then start to try and get code working for the second problem - so I'm stuck on both counts.
Thanks again!! Kind regards, Tom

Problem rendering SVG in Chrome mobile and iOS Safari mobile

Video of the problem
The problem happens when there is a screen switch or browser minimization, and it only happens with the svg element. Has anyone encountered this? How to fix?
imagem here
I managed to correct
good through this post
Clipping path in SVG not working in Safari
and this post http://tutorials.jenkov.com/svg/clip-path.html
but I had to make some adaptations...
how did i fix this problem
1st first
had to change inline structure that comes before all sinline svgs
before:[enter image description here][1]
[1]: https://i.stack.imgur.com/W8Pbl.jpg
after:
enter image description here
so far I had already converted all patches into points
tools that helped me in this work:
1st crucial tool because it is possible to convert paths code into points codes for polygon
https://codepen.io/team/amcharts/full/zYORoNE software built on the code pen
2st another tool to remove parts of unnecessary text such as curly braces ({}) spaces and commas that because the conversion tool transforms results into arrray
http://www.unit-conversion.info/texttools/replace-text/
3st another tool to remove lines breaks
https://www.textfixer.com/tools/remove-line-breaks.php
4st another last tool but not less important because it is possible to test directly online before inserting it in the code definitively
https://www.w3schools.com/graphics/tryit.asp?filename=trysvg_polygon
that was a good tool
final result :
before
before applying any new structure
after: after applying any new structure
I want to thank all the devs who collaborated with me, either by creating the free software and the post made, my thanks to everyone, the people of the stackoverflow, thanks!

I need to Cut and Mix Strings

i would like to know how i could cut and mix strings, im making a player fusion script for my game, but i dont know how i can make their name be togheter, like, if player 1 name is LordNoob and player 2 name is Keyboard then it would mix their names to one like Lordoard or KeyNoob something like that.
Ive searching a few things on the roblox wiki but i didnt found nothing, i saw string patterns but i dont know if it would help me.
If anyone could tell me what i could do it would be a cool help. thank you.
I've tried making a function for you which works okay, having the flaws that Paul mentioned
function mixStrings(string1,string2)
return string.upper(string.sub(string1,1,1)) .. string.lower( string.sub( string.sub(string1,1,math.floor(string.len(string1)/2)) ,2,string.len(string.sub(string1,1,math.floor(string.len(string1)/2)))) .. string.sub(string2,math.ceil(string.len(string2)/2),string.len(string2)) )
end
print(mixStrings("Keyboard","Calculator"))
print(mixStrings("Narwhal","Shark"))
print(mixStrings("America","Europe"))
print(mixStrings("Spoon","Fork"))
Running the above script resulted in the following when I tested it:
Keybulator
Narark
Amerope
Spork
(Btw the function will always make a string with a capitalized first letter and the rest will be lowercase, so it probably won't be useful if you're aiming to make something like KeyNoob)

Need assistance getting (parsing?) these JSON data into Xcode

Before I start, I would like to say that I'm quite a newbie to Xcode and the C Language, and I'm trying my best to learn as much as I can. I have researched for about 2 days now before posting this question but could not find anything helpful :( I am genuinely stuck and would appreciate ANY help. This is most likely a very simple/basic question:
Basically, I am trying to get this data (LINK) which is apparrently in UTF-8 JSON and display it on a simple label on Xcode. However, I do not know how to get that data and parse it at all. I've followed a tutorial online with success, but that deals with JSON objects rather than arrays (which I think I am dealing with).
I would HIGHLY appreciate it if someone could extract/parse the data from the first link given into a basic label on Xcode in code format.Preferably with commentary on what most lines of code are doing for my own benefit, as this would really help me understand how it works. Hopefully from there, I would be able to make good progress.
Once again this is highly appreciated!
Thank YOu.
Here's a sample of the JSON URL for convenience if you don't want to click the link:
[4,"1.0",1343920773538]
[1,"Spring Gardens","59581","275","Barkingside",1343920940000,1343920940000]
[1,"Spring Gardens","59581","275","Barkingside",1343921717000,1343921717000]
[1,"Spring Gardens","59581","549","Loughton",1343921858000,1343921858000]
[1,"Spring Gardens","59581","275","Barkingside",1343922204000,1343922204000]
[2,"Spring Gardens","59581","8a56a0ab37b72b400137cb7cfd954038_29222",0,3,"Bus routes serving this stop are subject to change during the Olympics and Paralympics games. For more information visit www.tfl.gov.uk/buses for more information.",1344668400000]
Use JSONObject like that tutorial shows, you should get a NSDictionary or NSArray at the end which will contain all your values just map those to the label in the end.
If you dont wan to do that, save the response in a char array and navigate through it while checking for [ or " characters when you find one read the chars until the next occurrence and save all the data you read into an array or something but this is messy and involves atleast 3-4 hours of writing your own custom logic for JSON data decryption, you should use JSONObject which is pretty simple
Hi i have this same problem. I have been looking for a json solution and currently i found that the best way to deal with this data is to parse is as csv instead. The solution seems straight up when you try to parse it as CSV instead of JSON

Parse a pdf file

I got a pdf like this one :
81 11005589 THING MAXIME 4 PC2I TR1 - MERCREDI DE 07H45 A 09H45 4A7
71 11007079 STUFF QUENTIN 1 PC2I TR1 - LUNDI DE 10H00 A 12H00 1B4
74 10506940 HAHA YEZHOU 2 PC2I TR1 - LUNDI DE 13H30 A 15H30 2D5
http://i.stack.imgur.com/hbXg2.png
And I need to parse it. What I mean by that is take the 4th column, add the 3rd column and make an email adress out of it. For example with the first line : maxime.thing#something.com
I tried to c/p it to Google docs but it just c/p it in one cell instead of multiple cells.
I really don't know what to do here. I guess regex would help me but with what ?
If it is Java iText, if it is C# iTextSharp, both are free for non commercial use.
I've used Aspose before for parsing PDFs/Word docs/Excel docs/and some other docs before. I'm not sure what their capabilities are when it comes to parsing tables in a PDF but it wouldn't surprise me if they had something.
I'd start by looking at them but be warned: they have an unapologetically piss poor method for updating their libraries. I have had to rewrite code because they flat out DROP functionality when they release new versions. Not deprecated, just GONE. That said their support is alright and the tool-set is quite powerful.
I know they have libraries for .NET and Java. Beyond that I can't say.
If in PHP, you can use
exec('pdftotext '.$filepath, $outputAsArray); //execute the command pdftotext. Proabably installed if you're on linux, if not you can install it /// to transform the pdf to text,
then
$text = implode($outputAsArray,"\n"); //to have the output as text
then preg_replace is your friend.
You can't just use a regular expression to parse PDF. You need to extract the text. There are many libraries that can do this for different languages.
My company, Atalasoft, has a text extraction add-on for .NET -- http://www.atalasoft.com/products/dotimage/pdf-reader
For Java, take a look at PDFTextStream from Snowtide. http://www.snowtide.com.
You cannot be sure there is any structure in the PDF of that the text is visible. You really need to use an extraction tool. I wrote an article explaining what formatting is actually in a PDF file at http://www.jpedal.org/PDFblog/?p=228

Resources