How would I go about getting the Album cover art and saving it locally - spotipy

How would I go about getting the Album cover art and saving it locally?
I'd like to do do "myscript.py "ARTISTNAME" "ALBUMNAME" and have it output the album cover art to a file in the format of "Artist-Album.jpg(whatever format Spotify uses)".

Related

Biblatex doesn't compile. Probably .bib file not recognised

I've spent many hours trying to get my bibliography working - unsuccessfully. I suspect that, somehow, my .bib file doesn't get recognised.
Help would be greatly appreciated.
MWE:
\documentclass[a4paper, 12pt]{article}
\usepackage{array}
\usepackage{lscape}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage[utf8]{inputenc}
\usepackage{babel,csquotes,xpatch}
\usepackage[backend=biber,style=authoryear, natbib]{biblatex}
\addbibresource{test.bib}
\usepackage{xurl}
\usepackage[colorlinks,allcolors=blue]{hyperref}
\begin{document}
This is a test... test test\\
\cite{glaeser_gyourko}\\
\cite{hsieh-moretti:2019}\\
\cite{glaeser_gyourko}\\
\printbibliography
\end{document}
test.bib file:
#article{hsieh-moretti:2019,
Author = {Hsieh, Chang-Tai and Moretti, Enrico},
Title = {Housing Constraints and Spatial Misallocation},
Journal = {American Economic Journal: Macroeconomics},
Volume = {11},
Number = {2},
Year = {2019},
Month = {4},
Pages = {1-39},
DOI = {10.1257/mac.20170388},
URL = {https://www.aeaweb.org/articles?id=10.1257/mac.20170388}
}
#article{glaeser_gyourko,
Author = {Glaeser, Edward and Gyourko, Joseph},
Title = {The Economic Implications of Housing Supply},
Journal = {Journal of Economic Perspectives},
Volume = {32},
Number = {1},
Year = {2018},
Month = {2},
Pages = {3-30},
DOI = {10.1257/jep.32.1.3},
URL = {https://www.aeaweb.org/articles?id=10.1257/jep.32.1.3}
}
In PDF it looks like this: enter image description here
I get the following information in the source viewer:
Process started
INFO - This is Biber 2.14 INFO - Logfile is 'test.blg' INFO - Reading
'test.bcf' INFO - Found 2 citekeys in bib section 0 INFO - Processing
section 0 INFO - Globbing data source 'test.bib' INFO - Globbed data
source 'test.bib' to test.bib INFO - Looking for bibtex format file
'test.bib' for section 0 INFO - LaTeX decoding ... INFO - Found
BibTeX data source 'test.bib'
Process exited with error(s)
I use texmaker 5.0.4 on MacOS and I post my configurations here:
enter image description here enter image description here
I really have very little idea on what goes on. Today, I started a work session, added a new source and it didn't work. I deleted the new source so that the bibliography would be the same as prior to me changing it, and it didn't work either. So, this let's me assume that, somehow, the program doesn't understand where the bibliography is. The .bib file and the document are in the same folder.
What I tried:
Triple checked code in bibliography using tools such as https://biblatex-linter.herokuapp.com/
Clear the cache of all documents.
change the natbib in the command \usepackage[backend=biber,style=authoryear, natbib]{biblatex} to biber -> doesn't seem to work.
Left out natbib and got same result. \usepackage[backend=biber,style=authoryear, natbib]{biblatex} => \usepackage[backend=biber,style=authoryear]{biblatex}
Add the command \usepackgage{natbitb} in addition to biblatex but this produces compatibility issues.
Add the codes \usepackage[utf8]{inputenc} &
\usepackage{babel,csquotes,xpatch} because they are recommendet by this biblatex cheat sheet: http://tug.ctan.org/info/biblatex-cheatsheet/biblatex-cheatsheet.pdf. Didn't change anything.
Thanks for your time!
I had a similar problem, what helped me was looking up the articles and rewriting them via the Google Scholar bibTex version.
The problem arose as I changed the name manually. This results in an error which is not recognized. And this threw me into researching exactly the same kind of .bib file not recognized error.
Your housing article should be formatted like this:
#article{hsieh2019housing,
title={Housing constraints and spatial misallocation},
author={Hsieh, Chang-Tai and Moretti, Enrico},
journal={American Economic Journal: Macroeconomics},
volume={11},
number={2},
pages={1--39},
year={2019}
}
I found another source of this problem Citavi generates invalid bibtex syntax. Often the year field is not correctly filled or special characters are not escaped properly. Maybe these are data errors which have their origin in the sources not in Citavi, but nonetheless often Citavi does not export valid bibtex format.

Save Images in Room Database

I want to save small images in my room database and I have two issues:
How do I save an image in my database?
How do I save multiple images in my database?
I tried saving a bitmap in the way recommended by the developers page (https://developer.android.com/training/data-storage/room/defining-data)
#Parcelize
#Entity(tableName = "image_table")
data class ImgMod(
#PrimaryKey(autoGenerate = true)
var invoiceId: Long = 0L,
#ColumnInfo(name = "image")
var single_img: Bitmap?
): Parcelable
However, I receive the following error:
Cannot figure out how to save this field into database. You can consider adding a type converter for it.
Secondly, I would like to save multiple images in one database entry. But I receive the same error with the following snippets:
#ColumnInfo(name = "imageList")
var img_list: ArrayList<BitMap>
or decoded bitmap as a String
#ColumnInfo(name = "imageList")
var decoded_img_list: ArrayList<String>
I am sorry if this is a very basic question. But how do I have to configure the database/process the data to an image list?
Thank you in advance,
rot8
A very simple way to get images into the database (although I personally discourage it) would be to base-64 encode the bitmaps into a String and put it into a row of the database.
Take in account that bitmaps are very memory heavy; and base64 encoding something increases it's size some more so be careful when loading a bunch of images... I do also think Room and SQLite supports binary data as blobs, so you could just declare a column as ByteArray and it should just work.
What I've been doing in my projects is to write them into the internal or external storage of my app and then store the reference Uri as a String to later be able to retrieve the image from disk.
Something that I discourage even more is to stuff more than one value per row; having a list of stuff inside a coulmn in SQL is definetely not a pattern you should follow. Creating a "join" table should be simple enough or simply an extra column you could use to group them by should be easy enough, right?

Is it possible to extract data from a parts catalog software

I need to extract all the data I can find from these parts catalogs. Each catalog is in its own folder that looks like this.
Here is the PEid from the application
Here is how that data looks like when its viewed in the software.
Here is a list of all the files in the application directory
ASYCFILT.DLL
BIN
BTRDP32.ocx
btrv.reg
catalog.dll
COMCAT.DLL
COMCT332.OCX
COMDLG32.OCX
DAO350.DLL
dao360.dll
DBADAPT.DLL
DBGRID32.OCX
DBLIST32.OCX
expsrv.dll
Findfile.avi
IMGADMIN.OCX
IMGCMN.DLL
IMGEDIT.OCX
IMGSCAN.OCX
IMGSHL.DLL
IMGTHUMB.OCX
jdX.exe
MFC42.DLL
msado21.tlb
MSADODC.OCX
MSBIND.DLL
MSCOMCT2.OCX
MSCOMCTL.OCX
MSCOMM32.OCX
MSDATGRD.OCX
MSDATLST.OCX
MSDERUN.DLL
MSFLXGRD.OCX
MSHFLXGD.OCX
MSJET35.DLL
msjet40.dll
MSJINT35.DLL
msjint40.dll
MSJTER35.DLL
msjter40.dll
msjtes40.dll
MSMAPI32.OCX
MSMASK32.OCX
MSRD2X35.DLL
msrd2x40.dll
msrd3x40.dll
MSREPL35.DLL
msrepl40.dll
MSSTDFMT.DLL
MSVBVM50.DLL
MSVBVM60.DLL
MSVCIRT.DLL
msvcrt.dll
MSVCRT40.DLL
mswdat10.dll
mswstr10.dll
OIADM400.DLL
OICOM400.DLL
OIDIS400.DLL
OIFIL400.DLL
OIGFS400.DLL
OIPRT400.DLL
OISLB400.DLL
OISSQ400.DLL
OITWA400.DLL
OIUI400.DLL
OLEAUT32.DLL
oleDB.dll
OLEPRO32.DLL
path.dat
prcopts.dat
print.txt
recall.dat
reg.bat
REGICON.OCX
RICHED32.DLL
RICHTX32.OCX
scrrun.dll
SIMPDATA.TLB
STDOLE2.TLB
SYSINFO.OCX
sysprint.dat
TABCTL32.OCX
Uninstall.exe
unreg.bat
VB5DB.DLL
VB6STKIT.DLL
VBAJET32.DLL
vsflex8l.ocx
W32mkde.exe
W32mkrc.dll
Wbtrv32.dll
WBTRVC32.DLL
Here is a listing one of the PARTLIST.DAT files from XORStrings
How can i extract the data from the files?
I've been looking at reverse engineering but not sure which direction to go with that. Do I have to start at the application (exe) level to get the data extracted? Can I not find a way to extract directly from the dat file itself?
I used IDA to upend the dat file and I can see the data that matches the application. But I cannot extract that data without pulling all the raw data with it.

lame-3.100.tar.gz has no lame.exe?

guys!I have downloaded lame-3.100.tar.gz from the site of lame,and I want to convert one song which format is ape to mp3 by Foobar2000.But there's no lame.exe when I have unarchivered the document.Does anybody know solutions?

how to get array from and xml file in swift

I am new to swift but I have made an android app where a string array is selected from an xml file. This is a large xml file that contains a lot of string arrays and the app gets the relevant string array based on a user selection.
I am now trying to develop the same app for iOS using swift. I would like to use the same xml file but I can not see and easy way to get the correct array. For example, part of the xml looks like this
<string-array name="OCR_Businessstudies_A_Topics">
<item>1. Business objectives and strategic decisions</item>
<item>2. External influences facing businesses</item>
<item>3. Marketing and marketing strategies</item>
<item>4. Operational strategy</item>
<item>5. Human resources</item>
<item>6. Accounting and financial considerations</item>
<item>7. The global environment of business</item>
</string-array>
<string-array name="OCR_Businessstudies_AS_Topics">
<item>1. Business objectives and strategic decisions</item>
<item>2. External influences facing businesses</item>
<item>3. Marketing and marketing strategies</item>
<item>4. Operational strategy</item>
<item>5. Human resources</item>
<item>6. Accounting and financial considerations</item>
</string-array>
If I have the string "OCR_Businessstudies_A_Topics" how do i get the "OCR_Businessstudies_A_Topics" array from the xml file.
This is very straight forward in android and although I have used online tutorials for swift it seems like I have to parse the xml file but do not seem to be getting anywhere.
Is there a better approach than trying to parse the whole xml fie?
Thanks
Barry
You can write your own XML parser, conforming to NSXMLParser or use a library like HTMLReader:
let fileURL = NSBundle.mainBundle().URLForResource("data", withExtension: "xml")!
let xmlData = NSData(contentsOfURL: fileURL)!
let topic = "OCR_Businessstudies_A_Topics"
let document = HTMLDocument(data: xmlData, contentTypeHeader: "text/xml")
for item in document.nodesMatchingSelector("string-array[name='\(topic)'] item") {
print(item.textContent)
}

Resources